最近在学习curl,下来用php模拟提交美团网的反馈页面
页面地址:http://www.meituan.com/feedback/default/
搜索form 查看post接收地址即是http://www.meituan.com/feedback/default/
再搜索name得到form里要填的内容
反馈类型type 反馈内容content 联系方式email,这是我们要提交的
最终代码
$post_string = array( 'type'=>1, 'content'=>'this is test content', 'email'=>'test@126.com' ); //http://localhost/svn/php/case/CURL/receivePOST.php echo request_by_curl('http://www.meituan.com/feedback/default/', $post_string); function request_by_curl($remote_server, $post_string) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $remote_server); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //用户代理头 curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.3 Safari/537.36"); $data = curl_exec($ch); curl_close($ch); return $data; }
运行,看到提交成功,谢谢您的支持,说明提交成功了