Is there a way to tell curl to not use cache

前端 未结 5 1948
盖世英雄少女心
盖世英雄少女心 2021-02-01 03:45

I am trying to find out file size of an url:

$url1 = \'www.google.com\';
$curl1 = curl_init();
curl_setopt($curl1, CURLOPT_URL, $url1); 
curl_setopt($curl1, CURL         


        
5条回答
  •  清歌不尽
    2021-02-01 04:37

    curl_setopt($curl1, CURLOPT_FRESH_CONNECT, 1); // don't use a cached version of the url

    CURLOPT_FRESH_CONNECT TRUE to force use of a new connection instead of a cached one.
    

    check example here

    you can set header

    $headers = array( 
                     "Cache-Control: no-cache", 
                    ); 
    curl_setopt($curl1, CURLOPT_HTTPHEADER, $headers);
    

    this link may be helpful to you http://www.php.net/manual/en/function.curl-setopt.php#96903

提交回复
热议问题