Does PHPs fopen function implement some kind of cache?

后端 未结 5 1885
刺人心
刺人心 2020-12-11 23:16

I\'m struggling with the automated data collection of a PHP script from a webserver. The files in question contain meteo data and are updated every 10 minutes. Weirdly enoug

5条回答
  •  余生分开走
    2020-12-12 00:01

    maybe this can resolve your problem (POST request can't be cached as far i know)

    $opts = array('http' =>
      array(
        'method'  => 'POST',
        'content'=>''
      )
    );
    $context  = stream_context_create($opts);
    $resource = fopen ('http://example.com/your-ulr', 'r', false, $context);
    
    /* or you can use file_get_contents to retrieve all the file 
       $fileContent = file_get_contents('http://example.com/your-ulr', false, $context);
    */
    

提交回复
热议问题