Asked by duncanb7
at 2024-06-02 01:03:16
Point:500 Replies:4 POST_ID:828558USER_ID:11059
Topic:
Apache Web Server;;PHP Scripting Language
Normally we can check the HTTP connection status by $info = curl_getinfo($curl) and
echo out $info['http_code'] in php , for example HTTP 200 OK for request success which
is generated from the server for client request.
But for HTTP 304 status code for curl php program, a little bit confused for me, Just want to know the mechanizm of http 304(not modified) generation. Is the http 304 generated by Broswer like Firefox when curl_exec() is sumbitted if previous same webpage is
requested again ? If so, browser
will check the cache folder and check whether the request webpage is existing on client/user computer. If existing, it won't process curl_exec function and just cache the webpage from users' computer to users and header out http 304 code. IF not exising, browser will let the curl_exec() in php program to continue.
Is that what I said is correct ?
When I output the http_code from getinfo($curl), it will report HTTP 304 when
the firefox cache setting on tool menu and uncheck the stopping cache box and request the same webpage again. When I disable stopping cache box on Firefox, it means no caching file, HTTP 304 code won't be generated, the http code is always HTTP200 OK
or HTTP 301 Moved permentantly
Qusetion-1 http 304(not modified) status code is generated by broswers instead of server. ?
Question-2 server can be able to check client's cache setting or ability and header("HTTP1.1 304 Not Modified) in php and echo to header of the webpage if
users requested the webpage is owned by server , Right ?
Please advise
Duncan
echo out $info['http_code'] in php , for example HTTP 200 OK for request success which
is generated from the server for client request.
But for HTTP 304 status code for curl php program, a little bit confused for me, Just want to know the mechanizm of http 304(not modified) generation. Is the http 304 generated by Broswer like Firefox when curl_exec() is sumbitted if previous same webpage is
requested again ? If so, browser
will check the cache folder and check whether the request webpage is existing on client/user computer. If existing, it won't process curl_exec function and just cache the webpage from users' computer to users and header out http 304 code. IF not exising, browser will let the curl_exec() in php program to continue.
Is that what I said is correct ?
When I output the http_code from getinfo($curl), it will report HTTP 304 when
the firefox cache setting on tool menu and uncheck the stopping cache box and request the same webpage again. When I disable stopping cache box on Firefox, it means no caching file, HTTP 304 code won't be generated, the http code is always HTTP200 OK
or HTTP 301 Moved permentantly
Qusetion-1 http 304(not modified) status code is generated by broswers instead of server. ?
Question-2 server can be able to check client's cache setting or ability and header("HTTP1.1 304 Not Modified) in php and echo to header of the webpage if
users requested the webpage is owned by server , Right ?
Please advise
Duncan