Why get_meta_tags() not working properly
I have used get_meta_tags("squidoo.com") to get keywords and description. When I run in my PC with WAMP Server 2.1 (PHP 5.3) it working perfectly but when i upload to linux server PHP 5.2 It is not work for squidoo.com .
I test with
$datas = get_meta_tags("http://squidoo.com")
$keywrds = $datas['keywords'];
$desc = $datas['description'];
When I run in my开发者_运维百科 PC it work perfectly but there is blank data in $keywrds and $desc when i upload to server.
Above code work with almost sites, I got error with www.squidoo.com and some others only
you haven't given us much info on the errors you're getting, but the most likely reason for this to fail is that your local server is configured to allow commands which open a file to use a URL, whereas your Linux server isn't.
This is a PHP.ini configuration setting, which specifies whether you can use URLs as file names. If it is switched off then PHP won't allow you to open files from a remote site and will only allow it from files on its local server.
Switching it off is considered good security practice, so most PHP hosting providers will turn it off by default. You may be able to turn it on youself, depending on your provider, or you may just have to work around it by downloading the URL using CURL and then examining the downloaded file.
See the PHP manual entry for this config setting here: http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen
That might be because you have local file called squidoo.com
on your WAMP setup. If you want it to work on the actual website, then you have to provide an URL:
print_r(
get_meta_tags("http://squidoo.com")
);
Notice the http://
which differentiates web addresses from files.
精彩评论