-2

This code print_r($_SERVER) give the current URL information but I want to be able to pass any URL in curl take the request header information, eg:

  • Pragma,
  • keep-alive,
  • Accept-Charset,
  • Host,
  • Connection,
  • Cache-Control,
  • Accept-Encoding,etc...
msturdy
  • 10,479
  • 11
  • 41
  • 52
  • possible duplicate of [How to print all information from an HTTP request to the screen, in PHP](http://stackoverflow.com/questions/3136253/how-to-print-all-information-from-an-http-request-to-the-screen-in-php) – leo May 05 '14 at 09:15
  • This [has](http://stackoverflow.com/questions/10751148/how-to-capture-full-http-request-data-headers-and-body-with-php) [been](http://stackoverflow.com/questions/3136253/how-to-print-all-information-from-an-http-request-to-the-screen-in-php) answered a few times already, please make a simple search before posting new questions! – leo May 05 '14 at 09:19
  • possible duplicate of [how to get request headers in php using any url like(www.w3schools.com)](http://stackoverflow.com/questions/23334075/how-to-get-request-headers-in-php-using-any-url-likewww-w3schools-com) – brasofilo May 05 '14 at 10:04

1 Answers1

1
$url = 'http://www.google.com';

print_r(get_headers($url));

http://us3.php.net/manual/en/function.get-headers.php

Abhik Chakraborty
  • 44,654
  • 6
  • 52
  • 63