phpcurlpost:PHP的curl实现get和post来源: 发布时间:星期二, 2008年12月30日 浏览:100次 评论:0
类似于dreamhost这类主机服务商
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 代码实现: 1、http ![]() $ch = curl_init("http://www.webjx.com/") ; curl_ ![]() curl_ ![]() $output = curl_exec($ch) ; $fh = fopen("out.html", 'w') ; fwrite($fh, $output) ; fclose($fh) ; 2、http ![]() //extract data from the post extract($_POST) ; // ![]() $url = 'http://www.webjx.com/get-post.php' ; $fields = 'lname'=>urlencode($last_name) , 'fname'=>urlencode($first_name) , 'title'=>urlencode($title) , 'company'=>urlencode($institution) , 'age'=>urlencode($age) , 'email'=>urlencode($email) , 'phone'=>urlencode($phone) ); //url- ![]() foreach($fields as $key=>$value) { $fields_ ![]() rtrim($fields_ ![]() //open connection $ch = curl_init ![]() // ![]() curl_ ![]() curl_ ![]() curl_ ![]() ![]() //execute post $result = curl_exec($ch) ; //close connection curl_close($ch) ; 1
相关文章读者评论发表评论 |