简体   繁体   中英

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 . . . 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). Also, make sure error reporting is enabled.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM