Use PHP to grab html code from a site that requires a login?

lttldude9

New member
I am running this on wamp (localhost).

I want to do something like this:
<?php
$site = file_get_contents('http://www.example.com/');
echo $site;
?>

And it works correctly, except I wanted to use it for a site that requires me to login. I am logged in on my browser, but that doesn't seem to make a difference for the php script. Is there a way around this or an alternative programing language.

In the end, I want to be able to grab pieces of the html code from the site as variables for my program. Thanks
I don't want the login information, I just want the html that displays. I can login in, but the php script running on localhost can't, is there a way to run a script (maybe different than PHP) from your browser so it can access the html of these pages?
 
Back
Top