Getting HTTP response of a URL in PHP - XML -


I am trying to retrieve the status of the URL. I am writing PHP code to retrieve it, but I do not get the output, nothing is being displayed

I am reading the URL from the XML file and stored it in the variable I am I am

  file_get_contents ($ url); Echo $ http_respone_header [0];   

$ url contains the URL that I read from the XML file.

What you're doing is not getting the URL status, but the contents of the site. File_get_contents () gives false returns in case of incorrect / invalid url because it is described in the documentation

If you are trying to get the position, then you can easily find the solutions described in other topics on this site Can be used.

  & lt ;? Php $ url = 'http://www.wp.pl'; $ Handle = curl_init ($ url); Curl_setopt ($ handle, CURLOPT_RETURNTRANSFER, TRUE); / * Get HTML or linked to $ url * / $ response = curl_xac ($ handle); Check for / * 404 (file not found). * / $ HttpCode = curl_getinfo ($ handle, CURLINFO_HTTP_CODE); Echo $ httpCode; Curl_close ($ handle); ? & Gt;   

Link to the following topic:

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -