Re: cURL issues posting to an end point

From: Date: Thu, 11 Oct 2012 11:09:32 +0000
Subject: Re: cURL issues posting to an end point
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-319420@lists.php.net to get a copy of this message
On 04/10/2012 15:54, Bastien Koert wrote: > Hi All, > > I have a page that receives third party data into my app, xml data via > https post. This works fine and I receive the data as expected. The > issue I am facing is around posting XML data back as a synchronous > response to the post I receive. I am using the following code: > <snip> > > $result = curl_exec($ch); > > curl_close($ch); > // Print CURL result. > echo $ch_result; > } > > > The endpoint recipient says they are not receiving the data and I am > at a loss to figure out why. Any insight would be appreciated. > > Thanks, > Hi, Try adding some error checking before and after the curl_exec() call: // Check for an error if(curl_errno($ch)>0){ print "Error creating curl object: Err Number:". curl_errno($ch). " ,Description:" . curl_error($ch); } // Execute request $result = curl_exec($ch); // Check for an error again if(curl_errno($ch)>0){ print "Error executing query: Err Number:". curl_errno($ch). ", Description:" . curl_error($ch)); } It may also be wise to increase your time out whilst testing, just in case. Regards Ian --

« previous php.general (#319420) next »