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!

Link to comment
Share on other sites

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! :-)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.