Network resource retrieval problems after an http request is initiated

Source: Internet
Author: User
{Code...} is it feasible to use the curlHEAD protocol?
After an http request is initiated, the network displays various loaded resources. is php capable of obtaining the name size and other information of a type?

Is it feasible to use the curl HEAD protocol?

Reply content:
After an http request is initiated, the network displays various loaded resources. is php capable of obtaining the name size and other information of a type?

Is it feasible to use the curl HEAD protocol?

The description is not clear. you want:

  1. Does the server initiate a request to obtain information? => Feasible

  2. After the client web page is loaded, will the information obtained by the server browser be reported? => Not feasible

For 1, curl is a feasible solution. you do not need to use the HEAD method, GET, POST, DELETE, or PUT method to obtain the returned HTTP header, as long as you add the CURLOPT_HEADER parameter


  

Yes,

$info = curl_getinfo($ch);

Print $ info and you will need it.

$SERVER ['phpSELF '] # file name of the script being executed, which is related to document root.
$ _ SERVER ['argv'] # parameters passed to the script.
$ _ SERVER ['argc '] # contains the number of command line parameters passed to the program (if running in command line mode ).
$SERVER ['gatewayINTERFACE '] # The CGI standard version used by the server. For example, "CGI/1.1 ".
$SERVER ['serverName'] # NAME of the server host where the script is currently running.
$SERVER ['serverSOFTWARE '] # The string identified by the server, which is provided in the header of the response request.
$SERVER ['serverPROTOCOL '] # name and version of the communication PROTOCOL when requesting the page. For example, "HTTP/1.0 ".
$SERVER ['requestMETHOD '] # request METHOD for accessing the page. For example, "GET", "HEAD", "POST", and "PUT ".
$SERVER ['querySTRING '] # query STRING.
$SERVER ['documentROOT '] # the ROOT directory of the file where the script is currently running. Defined in the server configuration file.
$SERVER ['httpACCEPT '] # Accept of the current request: content in the header.
$SERVER ['httpACCEPT_CHARSET '] # Accept-Charset of the current request: content in the header. Example: "ISO-8859-1, *, UTF-8 ".
$SERVER ['httpACCEPT_ENCODING '] # Accept-Encoding of the current request: content in the header. For example, "gzip ".
$SERVER ['httpACCEPT_LANGUAGE '] # Accept-Language of the current request: content in the header. For example, "en ".
$SERVER ['httpCONNECTION '] # Connection of the current request: content in the header. For example, "Keep-Alive ".
$SERVER ['httpHOST '] # Host of the current request: content in the header.
$SERVER ['httpREFERER '] # Link to the URL of the previous page of the current page.
$SERVER ['httpUSERAGENT '] # Current requested UserAgent: header content.
$ _ SERVER ['https']-if accessed through HTTPS, it is set to a non-null value (on); otherwise, off is returned.
$SERVER ['remoteADDR '] # browsing the IP address of the user on the current page.
$SERVER ['remoteHOST '] # HOST name of the user browsing the current page.
$SERVER ['remotePORT '] # The PORT used by the user to connect to the server.
$SERVER ['scriptFILENAME '] # The absolute path name of the currently executed script.
$SERVER ['serverADMIN '] # Administrator information
$SERVER ['serverPORT '] # The PORT used by the server
$SERVER ['serverSIGNATURE '] # a string containing the server version and virtual host name.
$SERVER ['pathTRANSLATED '] # The basic path of the file system where the current script is located (not the document root directory.
$SERVER ['scriptName'] # contains the path of the current script. This is useful when the page needs to point to itself.
$SERVER ['requestURI '] # URI required to access this page. For example, "/index.html ".
$SERVER ['phpAuth_user'] # When PHP runs in the Apache module mode and uses the HTTP authentication function, this variable is the user name entered by the user.
$SERVER ['phpAUTH_PW '] # When PHP runs in the Apache module mode and uses the HTTP authentication function, this variable is the password entered by the user.
$SERVER ['authType'] # When PHP runs in the Apache module mode and uses the HTTP authentication function, this variable is the authentication TYPE.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.