CURL returns blank page

Hi Guys,

I have the following script. I am trying to integrate with Google Checkout, but it just returns a blank page. I have checked, double checked and triple checked all the information being provided to the POSTFIELDS - everything is 100% correct. I don’t understand what’s going on here.

I have CURL enabled and have also tried on a different server with same result.

Any ideas what could be wrong here?

$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL, $this->checkout_url.'/?');
		curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, 'cart='.base64_encode($this->GetXML()).'&signature='.base64_encode($this->CalcHmacSha1($this->GetXML())));
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
		curl_setopt($ch, CURLOPT_VERBOSE, 1);

Is is PHP set up to report errors?

Yes, PHP is set to report all errors at the top of the file:


try adding

 ini_set("display_errors", 1);

Still blank page :frowning:

is $this->checkout_url pointing to the correct location?

Yes, it is pointing to the correct location…

try to include in options

curl_setopt($ch, CURLOPT_HEADER, 1); 

and then echo the content, just to figure out the server’s response code, if it is 200 the problem is not in the CURL

Try the following:

 if(curl_errno($ch)) {
  echo 'Curl error: ' . curl_error($ch);

That should at least give you something to debug with!

Hope this helps

I’m surprised no one has mentioned the use of curl_getinfo, I find this function invaluable when debugging cURL operations.