William Piper wrote:
> 
> 
> [EMAIL PROTECTED] <mailto:listgroups08%40ozwebwiz.com> wrote:
>  >
>  >
>  > ----- Original Message -----
>  > From: "cosminx2003"
>  >
>  > Hi, i want to login on yahoo with php cURL, i made a script but i
>  > can't make it work fine (it gives me blank page).
>  > Please tell me how can i fix it.
>  > Thanks
>  >
>  > <?php
>  >
>  > $username = "user";
>  > $password = "pass";
>  > $ch = curl_init();
>  >
>  > curl_setopt ($ch, CURLOPT_URL, 'http://login.yahoo.com/config/login? 
> <http://login.yahoo.com/config/login?>
>  > <http://login.yahoo.com/config/login? 
> <http://login.yahoo.com/config/login?>>');
>  > curl_setopt ($ch, CURLOPT_POST, 1);
>  > curl_setopt ($ch, CURLOPT_POSTFIELDS,
>  > 
> "login=$username&passwd=$password&.src=&.tries=5&.bypass=&.partner=&.md5=&.hash=&.intl=us&.tries=1&.challenge=ydKtXwwZarNeRMeAufKa56.oJqaO&.u=dmvmk8p231bpr&.yplus=&.emailCode=&pkg=&stepid=&.ev=&hasMsgr=0&.v=0&.chkP=N&.last=&.done=");
>  >
>  > curl_setopt ($ch, CURLOPT_COOKIEJAR, "cookies.txt");
>  > curl_setopt ($ch, CURLOPT_COOKIEFILE, "cookies.txt");
>  >
>  > curl_setopt ($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Macintosh; U; PPC
>  > Mac OS X;en) AppleWebKit/419.2.1 (KHTML, like Gecko) Safari/419.3');
>  > curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
>  >
>  > $result=curl_exec ($ch);
>  > curl_close ($ch);
>  > echo $result;
>  >
>  > ------------------------------------
>  > Hello,
>  > I have done this before but I used header information to control the
>  > cookie without using cURL.
>  >
>  > Some things that don't look right to me -
>  >
>  > curl_setopt ($ch, CURLOPT_URL, 'http://login.yahoo.com/config/login? 
> <http://login.yahoo.com/config/login?>
>  > <http://login.yahoo.com/config/login? 
> <http://login.yahoo.com/config/login?>>');
>  >
>  > Shouldn't the '?' be with the rest of the query string instead here -
>  > "?login=$username&passwd=$password&.src=&......
>  >
>  > and -
>  >
>  > &.tries=5
>  >
>  > did you copy this from a browser? will it work manually into a browser?
>  >
>  > and
>  >
>  > &.challenge=ydKtXwwZarNeRMeAufKa56.oJqaO
>  >
>  > Is some sort of session token? Has it expired?
> 
> You're right, that is dynamic. I have written a function for scraping
> what input fields are currently on the page that will work perfectly for
> this.
> 
> Here is the script. I actually tested it with my username & password and
> it let me in just fine:

This is much easier to read: http://pastebin.com/m61c9fa40

Reply via email to