Reputation: 10632
I'm trying to communicate with a third party server using curl.
The authentication system is as follows:
This in itself has not been a problem and I am able to make requests etc, but whatever I send the server always responds 200 even if i send an invalid data format. If i put the same url in the browser it returns error messages about the invalid format.
Does anyone know why this might be? Thanks in advance,
function go($url,$postvars=null)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, '/tmp/cookie_.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/cookie_.txt');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch,CURLOPT_POST,count($postvars));
$postfields = http_build_query($postvars);
curl_setopt($ch, CURLOPT_POSTFIELDS,$postfields);
curl_exec($ch);
curl_close($ch);
}
go($url,$login_array); //login=>'',pass=>''
go($url,$some_request_array);
Upvotes: 0
Views: 403
Reputation: 113222
One very likely possibility is a bug in the server code that means it sends 200 statuses with its error messages. Hence while in the browser it'll be an error message, because that's what is in the body, it'll still be "successful". Put an intercept (firebug network, fiddler, etc) on the browser access and see what the status is.
If this is the case you've two options:
Upvotes: 1