Jump to content

Use PHP to login to a website and retrieve information...


JaredMathis

Recommended Posts

...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!!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

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.