Curl error: Could not resolve host: www.localhost

后端 未结 1 1694
失恋的感觉
失恋的感觉 2021-01-24 07:55

I get an error could not resolve host:www.localhost. I don\'t know why it is coming.

$url =\"http://www.localhost:81/dbWIP/selectApi.php?name=\".$na         


        
相关标签:
1条回答
  • 2021-01-24 08:18

    Remove www. in url

    Like this

    $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);
    

    and also verify your port number 81

    netstat -a -b
    

    that's tell you what program is bound to port 81

    0 讨论(0)
提交回复
热议问题