Hello, I am trying to build a script wich will log in automatically at this page: The problem is that because of all js and stuff from there i can't get it working. (This script is for a learning project, so there are no "bad" intension there). Anyone, any ideeas and suggestions?
I"m not too much sure about but may be you can try this.. 1. get that page and scrape some value of variable from source and post back to page.. post data is given bellow.. 2. $post = '__EVENTTARGET=&__EVENTARGUMENT=&__VIEWSTATE='.$value_scraped1.'&__PREVIOUSPAGE='.val.'&__EVENTVALIDATION='.$value_scraped3.'&ctl00%24hfUILocale=en_US&ctl00%24txtProductSearchName=Product+Search&ctl00%24cpContent%24txtUserName='.$email.'&ctl00%24cpContent%24txtPassword='.$password.'&ctl00%24cpContent%24btnSignIn=Sign+In'; )
Thanks. <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://e5.onthehub.com/WebStore/Security/SignIn.aspx?ws=82fe585a-db9b-e011-969d-0030487d8897&vsro=8'); curl_setopt ($ch, CURLOPT_POST, 1); //The value scrapped loc1 $password = ""; $email = ""; //Load the page and get the values here? curl_setopt ($ch, CURLOPT_POSTFIELDS, '__EVENTTARGET=&__EVENTARGUMENT=&__VIEWSTATE='.$value_scraped1.'&__PREVIOUSPAGE='.$val2.'&__EVENTVALIDATION='.$val3.'&ctl00%24hfUILocale=en_US&ctl00%24txtProductSearchName=Product+Search&ctl00%24cpContent%24txtUserName='.$email.'&ctl00%24cpContent%24txtPassword='.$password.'&ctl00%24cpContent%24btnSignIn=Sign+In'); curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt'); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); $store = curl_exec ($ch); curl_setopt($ch, CURLOPT_URL, 'https://e5.onthehub.com/WebStore/Account/YourAccount.aspx?ws=82fe585a-db9b-e011-969d-0030487d8897&vsro=8'); $content = curl_exec ($ch); echo $content; curl_close ($ch); ?> PHP: Should I scratch the value at the moment specificated on the comment, by having the page already loaded there? At this moment the code dont't do ahyhing, it just show me again the login page with no values in the fields.
no.. first load page into variable and scraped value which i've mentioned then again post value with url.. after close curl got?