Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- cURL / POST Connection issue


Piggo - 5:52 pm on Dec 9, 2011 (gmt 0)


Thanks, I've tried as you suggested with the URL just to check (http://example.com/pathname) and with the port specified, all below:

error_reporting(E_ALL);
ini_set('display_errors', 'On');
$request = '<?xml version="1.0" encoding="UTF-8" ?>XML IN HERE';
$url = "http://example.com/pathname";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PORT, 99999);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, urlencode($request));
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$result = curl_exec($ch);
echo '<br />Curl error: ' . curl_error($ch);
curl_close($ch);

That doesn't make any difference. I'm not in control of the server on the other end. But I've been told it's available and am currently trying to double check this with them.


Thread source:: http://www.webmasterworld.com/php/4395959.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com