Curl error unable to resolve how to adjust the host?

when calling the interface, the code is normal locally. When it is placed on the server, it is reported that the host cannot be parsed. It has been debugged several times, sometimes good and sometimes bad. What is the reason for this? is the code incorrect or is there something on the server that has not been set up? Is there any kind boss passing by to give me an answer? thank you very much!

$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_TIMEOUT, 3);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);

this is the curl code. Is there something missing?

Aug.24,2021

since there is no problem locally, I think it is because the dns server on the server is not configured or the dns cannot resolve the domain name you want to request. You can first test it through the curl command, curl your_url


try nslookup [domain name] on the target server to see if you can resolve it. No, it's just a problem with dns.

< hr >

clipboard.png

execute commands in shell, where is it?


is there another kind-hearted boss passing by to tell me about it?

Menu