curl post 函数
1 function curl_post($url,$post_data){ 2 if(empty($url) || !is_array($post_data)){ 3 return false; 4 } 5 $ch = curl_init(); 6 curl_setopt($ch, CURLOPT_POST, 1); 7 curl_setopt($ch, CURLOPT_URL,$url); 8 curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); 9 ob_start(); 10 curl_exec($ch); 11 $result = ob_get_contents() ; 12 ob_end_clean(); 13 return $result; 14 }
手册:http://cn2.php.net/manual/zh/ref.curl.php