簡體   English   中英

卷曲錯誤:無法解析主機:www.localhost

[英]Curl error: Could not resolve host: www.localhost

我收到一個錯誤,無法解析host:www.localhost 我不知道為什么會這樣。

$url ="http://www.localhost:81/dbWIP/selectApi.php?name=".$name;
$client = curl_init();
echo $client;
curl_setopt($client, CURLOPT_URL,$url);
curl_setopt($client,CURLOPT_RETURNTRANSFER,true);
curl_setopt($client, CURLOPT_HEADER, false);
$response = curl_exec($client);
curl_close($client);
echo $response
$result = json_decode($response);

刪除www. 在網址中

像這樣

$url ="http://localhost:81/dbWIP/selectApi.php?name=".$name;
$client = curl_init();
echo $client;
curl_setopt($client, CURLOPT_URL,$url);
curl_setopt($client,CURLOPT_RETURNTRANSFER,true);
curl_setopt($client, CURLOPT_HEADER, false);
$response = curl_exec($client);
curl_close($client);
echo $response
$result = json_decode($response);

並驗證您的端口號81

netstat -a -b

告訴您什么程序綁定到端口81

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM