function curl_upload($post_url, $post_data) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $post_url);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/4.0");
$result = curl_exec($curl);
$error = curl_error($curl);
curl_close($curl);
return $error ? $error : $result;
}
$data = curl_upload('http://xx.com/lists', $condition);
echo $data;exit();
然后运行php代码,告诉我:
有时会显示Could not resolve host: xx.com
有时会显示正确的数据
我试着解决它,我谷歌它,但不工作。所以我在这里寻求帮助。
ping xx.com好的
我的resolv.conf:
nameserver 8.8.8.8
nameserver 114.114.114.114
myhosts:
/ etc / hosts中:
xx.com 127.0.0.1