2

I want to get the header from a website with the IP address.

I used get_header() but this only works with URL! Are there other ways to do this? Without using gethostbyaddre.

0

4 Answers 4

5

You can actually use an IP. Since there's no code, I can't tell where you're going wrong. But I can tell how it should be done:

$url = 'http://173.194.65.101/'; $headers = get_headers($url); print_r($headers); 
Sign up to request clarification or add additional context in comments.

Comments

2
  • You have an IP address, e.g.: 127.0.0.1

  • You want to use get_headers() (with trailing s)

  • ...but get_headers() expects a URL:

    array get_headers ( string $url [, int $format = 0 ] ) 
  • You add http:// and you get a URL: http://127.0.0.1—voilá!

Comments

0

use $_SERVER['REMOTE_ADDR'] to get the ip address.

Comments

0

You can make a cUrl call than analyse and extract the headers from the server's reponse.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.