Jump to content

Getting external data from a logged in user


FalcorTheDog

Recommended Posts

I guess the best way to describe my problem is with an example:

 

If I am logged in to Yahoo with my Yahoo ID, and I visit: http://baseball.fantasysports.yahoo.com with my browser, it will tell me which Fantasy Baseball leagues I am in, and allow me to click on one to enter the league page.

 

I figured therefore, that if I were already logged in, that the following code, would display the same page (i.e. I would be able to see which leagues I am in):

 

$remotefile=fopen('http://baseball.fantasysports.yahoo.com/','r');
while (!feof ($remotefile)) {
$line = fgets($remotefile);
echo($line);	
}

 

Unfortunately, the resulting page asks me to sign in, and doesn't display the desired leagues.  But I AM still logged in to Yahoo.  If I were to try to visit: http://baseball.fantasysports.yahoo.com again in my broswer, it knows I'm still logged in and displays my leagues.

 

Basically I am trying to get at the names of the user's league with PHP, assuming the user is already logged in.  I need the exact HTML that would be seen by a user that typed this address into their browser.  Is this possible?  Thanks in advance!

Wow, sure had a hell of a time learning about cURL.  There seem to be very few (if any) decent tutorials on the subject and none of the sample scripts for logging into yahoo seemed to work on my server.  After several hours of pain and tedious work, I finally figured out how to do what I needed to do.  The final solution was only 11 lines of code, but damned if it wasn't one of the most obnoxious scripts i've ever written.  It was a painful, but rewarding experence to say the least.

 

Just wanted to say thanks for pointing me in the right direction! :-)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.