当前位置:网站首页>Titles can only be retrieved in PHP via curl - header only retrieval in PHP via curl
Titles can only be retrieved in PHP via curl - header only retrieval in PHP via curl
2022-07-03 19:29:00 【javail】
problem :
Actually I have two questions. Actually, I have two questions .
(1) Is there any reduction in processing power or bandwidth used on remote server if I retrieve only headers as opposed to full page retrieval using php and curl?(1) If I only retrieve the title instead of using php and curl Perform a full page search , Then the remote server used processing capacity or bandwidth Will it decrease ?
(2) Since I think, and I might be wrong, that answer to first questions is YES , I am trying to get last modified date or If-Modified-Since header of remote file only in order to compare it with time-date of locally stored data, so I can, in case it has been changed, store it locally.(2) Because I think , I may be wrong , The answer to the first question is For sure , I try to get the last modification date or If-Modified-Since The remote file of the title is only to compare it with the time and date, and the locally stored data , So I can , If it has been changed , Store it locally .However, my script seems unable to fetch that piece of info, I get NULL
, when I run this: however , When I run this , My script doesn't seem to get this information , I got NULL
:
class last_change { public last_change; function set_last_change() { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, "http://url/file.xml"); curl_setopt($curl, CURLOPT_HEADER, true); curl_setopt($curl, CURLOPT_FILETIME, true); curl_setopt($curl, CURLOPT_NOBODY, true); // $header = curl_exec($curl); $this -> last_change = curl_getinfo($header); curl_close($curl); } function get_last_change() { return $this -> last_change['datetime']; // I have tested with Last-Modified & If-Modified-Since to no avail }}
In case $header = curl_exec($curl)
is uncomented, header data is displayed, even if I haven't requested it and is as follows: If $header = curl_exec($curl)
Not enabled , Then the header data is displayed , Even if I didn't ask it , As shown below :
HTTP/1.1 200 OKDate: Fri, 04 Sep 2009 12:15:51 GMTServer: Apache/2.2.8 (Linux/SUSE)Last-Modified: Thu, 03 Sep 2009 12:46:54 GMTETag: "198054-118c-472abc735ab80"Accept-Ranges: bytesContent-Length: 4492Content-Type: text/xml
Based on that, 'Last-Modified' is returned. On this basis , return “Last-Modified”.
So, what am I doing wrong? that , What did I do wrong ?
Solution :
Reference resources : https://stackoom.com/en/question/5miZ边栏推荐
- 第一章: 舍罕王失算
- Redis master-slave synchronization, clustering, persistence
- Zhang Fei hardware 90 day learning notes - personal records on day 4, please see my personal profile / homepage for the complete
- PR 2021 quick start tutorial, how to create new projects and basic settings of preferences?
- Ego planner code parsing Bspline_ Optimizer section (1)
- Sentinel source code analysis part I sentinel overview
- Chapter 1: drinking soft drinks, step tariff calculation, step tariff calculation function, personal income tax, solving square root inequality, simplifying solving square root inequality, solving dem
- Go home early today
- Chapter 1: sum of three factorials, graph point scanning
- 第一章:求奇因数代数和,求同吗小数和s(d, n),简化同码小数和s(d, n),拓广同码小数和s(d, n)
猜你喜欢
第二章:求a,b的最大公约与最小公倍数经典求解,求a,b的最大公约与最小公倍数常规求解,求n个正整数的的最大公约与最小公倍数
Chapter 2: find the box array, complete number in the specified interval, and improve the complete number in the specified interval
Free hand account sharing in September - [cream Nebula]
QT -- qfileinfo file information reading
Common text labels
第一章:求奇因数代数和,求同吗小数和s(d, n),简化同码小数和s(d, n),拓广同码小数和s(d, n)
2022-06-25 网工进阶(十一)IS-IS-三大表(邻居表、路由表、链路状态数据库表)、LSP、CSNP、PSNP、LSP的同步过程
Using the visualization results, click to appear the corresponding sentence
第一章:三位阶乘和数,图形点扫描
What is the content of game modeling
随机推荐
Chapter 2: find the box array, complete number in the specified interval, and improve the complete number in the specified interval
[mathematical modeling] ship three degree of freedom MMG model based on MATLAB [including Matlab source code 1925]
02 -- QT OpenGL drawing triangle
I didn't cancel
QT -- qfileinfo file information reading
Summary of composition materials for 2020 high-frequency examination center of educational resources
Zhang Fei hardware 90 day learning notes - personal record on day 5. Please see my personal profile / homepage for the complete record
第一章:求奇因数代数和,求同吗小数和s(d, n),简化同码小数和s(d, n),拓广同码小数和s(d, n)
Day10 -- forced login, token refresh and JWT disable
Pecan — Overview
BOC protected alanine porphyrin compound TAPP ala BOC BOC BOC protected phenylalanine porphyrin compound TAPP Phe BOC Qi Yue supply
Detailed explanation of shuttle unity interworking principle
Leetcode 1189. Maximum number of balloons (special character count)
Chapter 1: drinking soft drinks, step tariff calculation, step tariff calculation function, personal income tax, solving square root inequality, simplifying solving square root inequality, solving dem
[leetcode] [SQL] notes
2022-06-30 advanced network engineering (XIV) routing strategy - matching tools [ACL, IP prefix list], policy tools [filter policy]
05 -- QT OpenGL draw cube uniform
Foundation of ActiveMQ
Go home early today
QT -- qfile file read / write operation