I'm trying to use cURL to login.
The HTML from the login page is doing something I never saw.
<input type="text" name="user_session[login]"/>
<input type="password" name="user_session[password]"/>
I have tried to:
user_session[login]=blablabla&user_session[password]=blablabla
But nothing, any idea?
Make sure you URL-encode the keys. I don't think those brackets are safe. PHP will parse those arguments as an array, but what the script does shouldn't matter if you're just trying to simulate a form submission. If you use the PHP 5 function http_build_query
with the array ['user_session' => ['login' => 'NAME', 'password' => 'PASS']]
it should return the query string you need, properly escaped (which can be appended to the URL after ?
or used as POST data with curl_setopt($resource, CURL_POSTFIELDS, http_build_query($args))
).
If it still doesn't work, post the whole form; there may be some other problem with your submission besides the brackets.
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.