[英]Send post with curl php
I'm trying to send some parameters for an autentication on a web page this is the code 我正在尝试在网页上发送一些用于验证的参数,这是代码
$url = "http://www.webpage.com/account/submit";
$handler = curl_init();
curl_setopt($handler, CURLOPT_URL, $url);
curl_setopt($handler, CURLOPT_POST,true);
curl_setopt($handler, CURLOPT_POSTFIELDS, "username=user@webmail.com&remember=true&password=123456");
$response = curl_exec ($handler);
curl_close($handler);
When I run this script shows nothing, Im trying to autenticate me succesfully into a website without the HTML form . 当我运行此脚本时,什么都没有显示,我试图将我成功地自动添加到没有HTML表单的网站中。 .
。 .
。 there is another way to do this ???
有另一种方法可以做到这一点?
Ofcourse it shows nothing. 当然,它什么也没显示。 You would at least have to
echo
something (and likely do something with $response
to actually check the result of the login). 您至少必须
echo
某些内容(并且可能使用$response
进行某些操作以实际检查登录结果)。 Also, make sure error reporting is enabled. 另外,请确保已启用错误报告 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.