I’m trying to add a line to my functions.php that does a behind-the-scenes HTTP request submitting some user information to a mailing list URL I have. I’m trying to test the code at the moment, but nothing seems to be working.
I have tried the following:
$url = 'blabla.org/mailinglist/add?' . $user_email;
$request = new WP_Http;
$result = $request->request($url);
and
wp_remote_post($url);
Neither have worked. However, if I Just copy and paste the URL into my web browser, it works fine. Please help!
Thanks,
Tre
Only use
wp_remote_post()
if you are actually posting something.Try using
wp_remote_get()
with a full urlperhaps you’re just missing
http://
?i.e.
$url = 'http://blabla.org/mailinglist/add?' . $user_email;