Reputation: 81
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
.
Upvotes: 2
Views: 383
Reputation: 146350
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á!
Upvotes: 2
Reputation: 5776
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);
Upvotes: 5
Reputation: 6112
You can make a cUrl call than analyse and extract the headers from the server's reponse.
Upvotes: 0