0

I tried to get last-modified from the webpage header using get_headers().

<?php
$url = 'http://www.example.com';

print_r(get_headers($url));

print_r(get_headers($url, 1));
?>

But I don't get result, and the code above says that

Warning: get_headers() has been disabled for security reasons in [...][...] on line 4

Warning: get_headers() has been disabled for security reasons in [...][...] on line 6

Does anyone knows how to fix this?

And how to get the headers of the webpage?

Exactly, I want to get the last-updated date or modified.

If that's not available, when the website was created.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Kid
  • 1,160
  • 2
  • 14
  • 31
  • 4
    that means your host has disabled that function – treyBake Oct 24 '19 at 12:38
  • 1
    Could you explain in details? Thanks. How can I fix it? – Kid Oct 24 '19 at 12:39
  • If get_headers is disabled then you can also use cURL instead. – Rp9 Oct 24 '19 at 12:40
  • @Rp9 without knowing server settings - that's not guaranteed – treyBake Oct 24 '19 at 12:40
  • 1
    @XiaoJin your hosting provider has disabled that function use - to fix, you'll have to raise a support ticket with them – treyBake Oct 24 '19 at 12:40
  • 1
    Actually, I am new to php and have no concept at all. many helps! – Kid Oct 24 '19 at 12:40
  • 1
    I have looked at the cURL, and tried like this "curl -I www.freelancer.com" but I don't see last updated date, seems it doesn't return any result about it. – Kid Oct 24 '19 at 12:45
  • @O.o Please [edit] your question to include the URL you want to check, the code you currently have (see [mcve]) and the list of all headers you get from the server. If the server is not sending these header information you obviously can't get this information from the headers. What exactly are you trying to do? Why do you want to read the last updated date? – Progman Dec 08 '19 at 10:10

0 Answers0