Jump to content

Page cached? Trying to get a page with file_get_contents()...


Symmetry

Recommended Posts

Here's my dilemma.. I'm trying to load a page from wikipedia with file_get_contents() and it seems to be loading an older version of the page and I'm not sure how to conquer this.. so how would I do it with PHP (or HTML?) so that I get the freshest page?

 

Here's the timestamp of the page php's loading:

<!-- Saved in parser cache with key enwiki:pcache:idhash:12762141-0!1!0!default!!en!2 and timestamp 20080516003812 -->

 

and the page when I go to it in the browser:

<!-- Saved in parser cache with key enwiki:pcache:idhash:12762141-0!1!0!default!!en!2 and timestamp 20080518020756 -->

 

As you can see one is from the 16th, and the other is from the 18th.

 

Thank you for assistance.

Thank you.. the time stamp now reads

<!-- Saved in parser cache with key enwiki:pcache:idhash:12762141-0!1!0!default!!en!2 and timestamp 20080518020756 -->

 

The current date, but it's still giving me issues as it's not the same page.. I'm confused.

 

Here's the code I'm using:

 

<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past

$file = file_get_contents("http://en.wikipedia.org/wiki/Category:Undrafted_National_Football_League_players");

echo $file;
?>

 

Maybe someone can try the code and see if it produces the same results for them, for me the last name on the page with file_get_contents() is Marques Douglas, when I goto the url via browser it's Robert Douglas (American football)  ???

Oh I see what you mean now. The code I gave you will ensure that the page you are viewing will not come from the cache.......but it won't make a difference to the linked file you are getting. Sorry, my mistake.

 

Not sure how to combat that issue you have

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.