PHP Curl on 81 port
17,115
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);
Comments
-
Gunjan Nigam almost 2 years
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
-
Gunjan Nigam over 11 yearsAs I stated in my question I tried using CURLOPT_PORT but that also doesn't work.
-
Gunjan Nigam over 11 yearsAs I stated in my question I tried using CURLOPT_PORT but that also doesn't work. These URLS are live URL. Can anybody else access these URL using CURL
-
Gunjan Nigam over 11 yearsAdvaitAmin Just referred me to the same URL, and I was not able to access the URL through CURL using the same code. But if you are able to do that with you above mentioned code, means I have some problem with my client network which is blocking port 81