function requestCurl($url,$type = 'get',$data=NULL)
{ $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); if('post'==$type){ curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); }else if('delete'==$type){ curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); curl_setopt($ch, CURLOPT_POSTFIELDS,$data); }else if('put'==$type){ curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, "PUT"); curl_setopt($ch, CURLOPT_POSTFIELDS,$data); } curl_setopt($ch, CURLOPT_URL,$url); $infos = curl_exec($ch); curl_close($ch); return $infos;}
在主機ping也可以. 大神求指導 不勝感激
回複內容:
function requestCurl($url,$type = 'get',$data=NULL)
{ $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); if('post'==$type){ curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); }else if('delete'==$type){ curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); curl_setopt($ch, CURLOPT_POSTFIELDS,$data); }else if('put'==$type){ curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, "PUT"); curl_setopt($ch, CURLOPT_POSTFIELDS,$data); } curl_setopt($ch, CURLOPT_URL,$url); $infos = curl_exec($ch); curl_close($ch); return $infos;}
在主機ping也可以. 大神求指導 不勝感激
dns網域名稱解析問題而已。其實我也不太懂。你最好做個配置 把相應網域名稱轉換為ip