JaredMathis Posted October 20, 2007 Share Posted October 20, 2007 ...specifically Facebook. I'm not trying to do anything bad. I am designing an application on Facebook, with a feature to access another application's HTML output source code and re-organize the information in a way that will be useful to me and several of my friends. It's just in order to view the application, you need to be logged in to the site. I'm not sure how to do this... I was thinking perhaps you could use fopen() on the URL and get PHP to somehow take a cookie file with it? I am using "PHP 5.2.4 - Intermediate Ver." and my website is hosted on the server "x10hosting.com." Thanks in advance!! Quote Link to comment https://forums.phpfreaks.com/topic/74034-use-php-to-login-to-a-website-and-retrieve-information/ Share on other sites More sharing options...
Ninjakreborn Posted October 20, 2007 Share Posted October 20, 2007 This is another example of "data harvesting". it's a big field, and it's something that takes a lot of work. Google "data harvesting", "data mining", "php data mining", "php data harvesting". Quote Link to comment https://forums.phpfreaks.com/topic/74034-use-php-to-login-to-a-website-and-retrieve-information/#findComment-373772 Share on other sites More sharing options...
sKunKbad Posted October 20, 2007 Share Posted October 20, 2007 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>All lines imported and shown "pre" style</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> </head> <body> <div> <?php //this gets all the lines of a file and outputs as code like <pre> of html $lines = file('http://www.openwebdesign.org'); foreach ($lines as $line_num => $line) { echo str_replace(" "," ",htmlentities($line)) . "<br />\n"; } ?> </div> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/74034-use-php-to-login-to-a-website-and-retrieve-information/#findComment-373778 Share on other sites More sharing options...
JaredMathis Posted October 20, 2007 Author Share Posted October 20, 2007 Okay, I know how to do that kind of thing with string replace -- I could just do like $var = file_get_contents("website") And I'm going to use string functions to manipulate it, however, I can't use these functions, because I need to 1. Fool the site into thinking I'm logged in 2. Since it's facebook - you need to make it think you're using firefox or something - so I will need to make it think it's receiving this request from a browser I wasn't clear enough. Quote Link to comment https://forums.phpfreaks.com/topic/74034-use-php-to-login-to-a-website-and-retrieve-information/#findComment-373791 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.