I am trying to get information of remote file with curl. Problem is that other web-server is on port 81.
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt ($ch, CURLOPT_PORT , 81);
curl_setopt($ch, CURLOPT_URL, 'http://98.246.25.185/server_status2.php');
$store = curl_exec ($ch);
echo substr($store, 1);
curl_close ($ch);
?>
And as you can see it doesnt work.
What happens if you specify the port number in the URI ?
What I mean is first remove the
CURLOPT_PORTline, and, then, modify theCURLOPT_URLone to add the port number :Edit after the comment : I just tryied this portion of code :
And I get this output :
So, the code seems to be OK.
Are you sure there is not a firewall or anything or your network, that prevents you from doing HTTP requests on port 81 to that server ?
Does it work when you type that URI in your browser ?