symfony 2.1 - Logging into form with cURL/PHP -


i'm trying login external site php's curl protocol.

this form in question

<form accept-charset="utf-8" action="/support/login" method="post">     <input name="utf8" type="hidden" value="&#x2713;" />     <input name="authenticity_token" type="hidden" value="phefln4n1clb/l8hnl1bbd6mk6tz1s5vfcexllam48o="/>     <input class="required special" id="user_session_email" name="user_session[email]" type="email" value="" />     <input class="special" id="user_session_password" name="user_session[password]" type="password">     <input name="user_session[remember_me]" type="hidden" value="0" />     <input checked="checked" id="user_session_remember_me" name="user_session[remember_me]" type="checkbox" value="1" />     <button type="submit" class="btn btn-primary btn-login"> login</button> </form> 

and have far:

$ch = curl_init(); $url = "example_url"; $username = "example@example.com"; $password = "example_password"; $postinfo = http_build_query(array('user_session[email]' => $username, 'user_session[password]' => $password));  curl_setopt($ch, curlopt_header, false); curl_setopt($ch, curlopt_nobody, false); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_ssl_verifyhost, 0); curl_setopt($ch, curlopt_referer, $_server['request_uri']); curl_setopt($ch, curlopt_ssl_verifypeer, 0); curl_setopt($ch, curlopt_customrequest, "post"); curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_postfields, $postinfo); curl_setopt($ch, curlopt_followlocation, true); curl_setopt($ch, curlopt_returntransfer, 1); 

i know need build in handling authenticity token, user session storage (cookie jar?) , possibly "remember me" button too. but, right i'm getting error return html no verification information registered @ all, nothing have working.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -