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();
then run the php code ,show me:
sometimes show Could not resolve host: xx.com
sometimes show the right data
i try to solve it,i google it ,but not work. so i ask here for help.
ping xx.com ok
my resolv.conf:
nameserver 8.8.8.8 nameserver 114.114.114.114
myhosts:
/etc/hosts: xx.com 127.0.0.1
who can give me help ,Tks!!