Jump to content

cURL acting different on different servers


slowfamily

Recommended Posts

Hello there,

 

I've been searching for a while but can't seem to find any similar mention to my problem.

 

I have a small script that uses curl to post a name and email address submitted on a form on one site to an email marketing service for newsletter optins:

 

function sendSubscription ($url,$params) {
$ch = curl_init ($url) ;
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, TRUE) ;
curl_setopt ($ch, CURLOPT_POST, TRUE) ;
curl_setopt ($ch, CURLOPT_POSTFIELDS, $params) ;
$res = curl_exec ($ch) ;
curl_close ($ch) ;
return ($res) ;
}

 

I am almost certain it previously was working, but now the response received in curl from the site I'm submitting to is 'invalid request'. Despite the fact that the code I am using primarily came from this company's website, they have told me they do not support php code or curl.

 

Interestingly, if I run the EXACT same script on another server, both of which are running the same version of Red Hat Linux, and both compiled with libcurl/7.12.1 OpenSSL/0.9.7a zlib/1.2.1.2 libidn/0.5.6, then the script runs successfully. The only obvious difference I see (I'm sure there's more) is that the server that it works on is running php 5.2.8, while the one that it is not working is 5.2.6.

 

Has anyone else experienced anything like this? Are there any other contributing factors that could cause this to happen, or could it just be the version difference? Possibly there's something else I'm overlooking..

 

Thanks!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.