How to detect if this is an ISP/Server cache?

Before we start: I’m a noob.

I’m trying to access YQL to get some information. Grabbing it using PHP’s file_get_contents is simple enough, but it seems like either the client’s ISP or the server is caching the response. To illustrate the problem, try loading:

Refresh that page a couple of times – notice that the ‘created’ string doesn’t change – it should be a couple of seconds off each time you refresh, like this test sample:

Now my question is, is this some sort of trick by the sysadmin to cache things, or something that the ISP do? Can I get around it? I must access the YQL via URL because I need to be able to parse it.

(The sysadmin is difficult to reach)

Thanks in advance.


EDIT

I’ve found out how to get around the cache. You can either randomize string and use the trick mentioned by @Coops below, or use the code here. Most of the times, you can skip the cache by sending Pragma: no-cache header, create a context and use it:

// Create a stream
$opts = array(
    'http'=>array(
    'method'=>"GET",
    'header'=>"Accept-language: en\r\n" .
              "Pragma: no-cache"
    )
);

$context = stream_context_create($opts);

// Open the file using the HTTP headers set above
$file = file_get_contents('http://example.com');

I still can’t figure out whether the cache is configured by sysadmin or the ISP though.

Related:


Leave a Reply