--- In php-list@yahoogroups.com, William Piper <[EMAIL PROTECTED]> wrote:
>
> 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
>

Hi, first i want to thank you because you want to help me.
I checked the script with my username and password and it doesn't
work. I receive a yahoo login page where i must enter the password of
my id and the following message :

"HTTP/1.1 302 Found Date: Thu, 16 Oct 2008 17:33:21 GMT P3P:
policyref="http://p3p.yahoo.com/w3c/p3p.xml";, CP="CAO DSP COR CUR ADM
DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi
IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV"
Location: https://login.yahoo.com/config/login_verify2? Cache-Control:
private Pragma: no-cache Expires: Thu, 05 Jan 1995 22:00:00 GMT
Connection: close Transfer-Encoding: chunked Content-Type: text/html
HTTP/1.1 200 OK Date: Thu, 16 Oct 2008 17:33:21 GMT P3P:
policyref="http://p3p.yahoo.com/w3c/p3p.xml";, CP="CAO DSP COR CUR ADM
DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi
IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV"
Cache-Control: private Connection: close Transfer-Encoding: chunked
Content-Type: text/html"

I saw you obtain the .challenge information with preg_match but at
every refresh that value it changes, i think this is the problem.
How it works at you??

Reply via email to