Here we go..
I have 2 sites.
I can access a protected area via HTTP this way:
http://www.sitetogetcodefrom.com/login.php?user=test&pass=test
This way I get redirected to a page (page1.php).
Now within page1.php page, there is a link to page2.php
When I click it I get to a page which contains other content than page1.php and is also only viewable if called through
http://www.sitetogetcodefrom.com/page1.php
So here's my problem:
I want to parse the URL to get the content of page1.php on another server.
My code looks like this:
$url = "http://www.sitetogetcodefrom.com/login.php?user=test&pass=test";
$unique_start = "<!-- start code -->"; // Where to begin to grab
$unique_end = "<!-- end code -->"; // Where to end the grab
$fetch_domain = parse_url($url);
$fetch_domain = $fetch_domain[host];
$fd = @fread(fopen("$url", "r"), 100000);
if ($fd)
{
$start= strpos($fd, "$unique_start");
$finish= strpos($fd, "$unique_end");
$length= $finish-$start;
$code = substr($fd, $start, $length);
}
So far, so good. $code contains a sniplet from page1.php.
My question. How do I get the code from page2.php which is only viewable via a link clickend on page1.php?
Of course it gives me a session error when I try to load the page directly via a http request.