PHP file_get_contents very slow when using full url

后端 未结 9 1045
我在风中等你
我在风中等你 2020-11-27 12:10

I am working with a script (that I did not create originally) that generates a pdf file from an HTML page. The problem is that it is now taking a very long time, like 1-2 mi

9条回答
  •  攒了一身酷
    2020-11-27 12:53

    I have a huge data passed by API, I'm using file_get_contents to read the data, but it took around 60 seconds. However, using KrisWebDev's solution it took around 25 seconds.

    $context = stream_context_create(array('https' => array('header'=>'Connection: close\r\n')));
    file_get_contents($url,false,$context);
    

提交回复
热议问题