我收到一个错误,无法解决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);
答案 0 :(得分:2)
删除网址中的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绑定了什么程序