PHP没有卷入自己的服务器

时间:2018-04-04 09:00:05

标签: php php-curl

注意: How to use basic authorization in PHP curl 对我不起作用。

$password = 'root';         
$username = 'password';
$URL='http://127.0.0.1';   //Curl into own machine local ip is needed.
$port = 7777;

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$URL);
curl_setopt($ch, CURLOPT_PORT, $port);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result=curl_exec($ch);

if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); }

$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);   

curl_close ($ch);

echo "<br>";
var_dump($result);
echo "<br>";
var_dump($status_code);

以下是我的错误

  

错误:

     

布尔(假)

     

INT(0)

以下是我的netstats。港口是开放和倾​​听的。

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:7777          0.0.0.0:*               LISTEN     
tcp6       0      0 :::22                   :::*                    LISTEN     
tcp6       0      0 :::80                   :::*                    LISTEN           

PHP7, PHP-CURL & CURL安装在Linux Fedora 27. Webserver类型Apache 2.4

试图卷入电子

0 个答案:

没有答案