I have locally set 2 Apache Server on Port 80 and port 81 using XAMPP. Iam successfully able to access them through my browser. Currently the URL can be accessed at
http://27.4.198.225/ncmsl/check.php
and
http://27.4.198.225:81/ncmsl/check.php.
When I try to write a simple curl code for them
$ch=curl_init();
$url = "http://27.4.198.225/ncmsl/check.php";
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($ch, CURLOPT_URL, $url);
curl_exec($ch);
curl_close($ch);
It works perfectly fine for server at port 80 but doesn't work for server at port 81, i.e.
$ch=curl_init();
$url = "http://27.4.198.225:81/ncmsl/check.php";
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($ch, CURLOPT_URL, $url);
curl_exec($ch);
curl_close($ch);
What could be the possible reason? I have tried using CURLOPT_PORT but that also doesn't work
These URL are LIVE URL. Can anybody check whether they are successfully able to access them using thei own CURL code on their own network
Try this
curl_setopt ($ch, CURLOPT_PORT , 81);
Update code:-
see this URL:- php curl problem
$ch = curl_init();
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_URL, 'http://27.4.198.225:81/ncmsl/check.php');
$store = curl_exec ($ch);
echo substr($store, 1);
curl_close ($ch);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With