Filipsik11
Filipsik11

Reputation: 21

PHP get website contents with anchor in url

I can get website content but I need to simulate click on detail icon to open the "Detail" window. I tried to add #detail=63710 to the URL but it did not work. If I load the URL with #detail=xxxxx in Google Chrome it shows the website with "Detail" window opened. How can I fix this?

This is my code:

<?php
$url='http://www.forexfactory.com/calendar.php?day=nov21.2016#detail=63710';

$lines_string=file_get_contents($url);

echo $lines_string;
?>

The result is:

But the original is:

Upvotes: 2

Views: 126

Answers (1)

user2693928
user2693928

Reputation:

You are making request and the html/css or javascript returned which is correct.

But the hash string is catched(#detail=63710) by javacript and after it executes it shows the difference in your results(try to disable javascript in your browser).

You can use some php library that provides browser simulation for example wait until javascript is executed and then get the html of the page.

Upvotes: 2

Related Questions