Hi,
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:
<?php
$current_site = get_site_url();
$my_email = "myemail@mydomain.com";
$subscription_url = $current_site . "/?na=s";
$newsletter_subscription_url = $subscription_url . "&ne=" . $my_email;
Requests::register_autoloader();
$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” 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