Hello,
I am trying to build a script wich will log in automatically at this page:
[text]https://e5.onthehub.com/WebStore/Securi ... 897&vsro=8[/text]
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).
Anyone, any ideeas and suggestions?
Help with php&curl
Moderator: General Moderators
Re: Help with php&curl
It will be a little difficult to advise, don't know what code you are using, and it isn't a site that you can just go sign up for an account to test things with...
Are you tracking cookie values? You will need to receive cookie information from the site which holds your session information, so that each page you do after that knows that you are already logged in. (can't advise with too many details, haven't actually made anything to do this yet myself.
Just curious what type of "Learning Project" involves automating into a system that provides licensed software from Microsoft...
-Greg
Are you tracking cookie values? You will need to receive cookie information from the site which holds your session information, so that each page you do after that knows that you are already logged in. (can't advise with too many details, haven't actually made anything to do this yet myself.
Just curious what type of "Learning Project" involves automating into a system that provides licensed software from Microsoft...
-Greg
-
Adrian11111
- Forum Newbie
- Posts: 3
- Joined: Fri Jan 06, 2012 9:12 am
Re: Help with php&curl
Code: Select all
<?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 = "";
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);
?>It is for at Faculty, so no harmfull meaning are intented.
As you can see the cookie will be stored in a text file to mimic the browser. The problem is that when i load the page it don't eaven return an error that the data was wrong. If i enter a valid login the same problem, it willl do nothing.
Any other ideeas?
Thanks
Re: Help with php&curl
First of all, check for a curl error
Also, check the curl info
Both of these must be done before the curl_close(); call
Also, I wouldn't be surprised if the site was refusing to recognize your cookies, especially the 'ASP.NET_SessionId' cookie that expires 'At End Of Session'.
Code: Select all
$ce = curl_error($ch);
$cn = curl_errno($ch);
echo "curl error: $cn $ce - $url".PHP_EOL;
Code: Select all
$info = curl_getinfo($ch);
var_dump($info);
Also, I wouldn't be surprised if the site was refusing to recognize your cookies, especially the 'ASP.NET_SessionId' cookie that expires 'At End Of Session'.
-
Adrian11111
- Forum Newbie
- Posts: 3
- Joined: Fri Jan 06, 2012 9:12 am
Re: Help with php&curl
Thank you for reply, i have managed to obtain something but id dont work...
My generated cookie looks like this right now:
[text]#HttpOnly_e5.onthehub.com FALSE / FALSE 0 ASP.NET_SessionId i5ktilewd0my43lrhlady4be
e5.onthehub.com FALSE / FALSE 0 .ASPXAUTH 0617AEEB10B9D81B48912B024EA9ABD36B650D92222C2C5E0AB932335E97C3B2BE101C3DB644001BD1D2FF15B857EA6FFC39C64A8631205456297F7937800CD86BF9DA10BCB6E7C7B7865C064F11ADE1C6873AE1419B6D41D5AC92374DD59A06D1C7F78BE2A91B9C2A76A7523F7C72A1F82B460063CBCB65898B96D6C3C61C00EA9579A80DE996CFD98554B9BD25480F5E5594B6034B9C096E5AA57556B5AC1987E34285CED08A1AFE6B7DC7C9F9DFB05AEAF3FEB21A826E2C9812A038235703E0D3F073CC9105B4003E9146CB65AFA387A82B73762A0CF4D0D7A04C87A1861AE48E2D3DA2EBA3C0CCDAF8BF295B842718222945F2CBCEF53B84E0E0C9F000ACE0A567A0345B9A8CDE1FC9E2580D608C7E8B24CF3EE2934642F7F35A4012CDEA8F9FC62F55B32013AD644837EFDE9F8A66A037863955986667519DD453B96AFF5D9E7B096E845745D59FF7A9CD11F1C4423FFF3D52DAAD2341306C4109BD3E50FB2562C8
[/text]
But it just dont work
My generated cookie looks like this right now:
[text]#HttpOnly_e5.onthehub.com FALSE / FALSE 0 ASP.NET_SessionId i5ktilewd0my43lrhlady4be
e5.onthehub.com FALSE / FALSE 0 .ASPXAUTH 0617AEEB10B9D81B48912B024EA9ABD36B650D92222C2C5E0AB932335E97C3B2BE101C3DB644001BD1D2FF15B857EA6FFC39C64A8631205456297F7937800CD86BF9DA10BCB6E7C7B7865C064F11ADE1C6873AE1419B6D41D5AC92374DD59A06D1C7F78BE2A91B9C2A76A7523F7C72A1F82B460063CBCB65898B96D6C3C61C00EA9579A80DE996CFD98554B9BD25480F5E5594B6034B9C096E5AA57556B5AC1987E34285CED08A1AFE6B7DC7C9F9DFB05AEAF3FEB21A826E2C9812A038235703E0D3F073CC9105B4003E9146CB65AFA387A82B73762A0CF4D0D7A04C87A1861AE48E2D3DA2EBA3C0CCDAF8BF295B842718222945F2CBCEF53B84E0E0C9F000ACE0A567A0345B9A8CDE1FC9E2580D608C7E8B24CF3EE2934642F7F35A4012CDEA8F9FC62F55B32013AD644837EFDE9F8A66A037863955986667519DD453B96AFF5D9E7B096E845745D59FF7A9CD11F1C4423FFF3D52DAAD2341306C4109BD3E50FB2562C8
[/text]
But it just dont work
Re: Help with php&curl
What is the output from curl_error() and curl_getinfo()?