Home Forums Newsletter Plugin Support newsletter subscription by http request or curl

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #26129

    I’m trying to submit a newsletter subscription request using the querystring “http://mysite/?na=s&ne=myemail@mydomain.com” making a GET request in PHP using the Requests library provided by WordPress, just like that code snippet:

       $current_site = get_site_url();
       $my_email = "myemail@mydomain.com";
       $subscription_url = $current_site . "/?na=s";
       $newsletter_subscription_url = $subscription_url . "&ne=" . $my_email;
       $response = Requests::get($newsletter_subscription_url); 

    When I use the link in my browser, the subscription works well with success, but using a GET request from PHP or a curl command in a shell like “curl http://mysite/?na=s&ne=myemail@mydomain.com&#8221; I can’t subscribe.
    Where is my error?
    Is it possible to subscribe in that way or the plugin doesn’t permit to do that?
    Is there another way to do the same thing, using the plugin provided functions, and, if yes, can I have an example and a code snippet to do the subscription operation?
    Than you in advanced.

    Best regards,
    Carlo Cocco


    You should disable the antibot option in the subscription config panel to make such a request.



    Thank you Stefano,
    with WordPress provided Request library it works now.
    I can’t do the same with curl, but it’s not important.
    Best Regards,
    Carlo Cocco

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.