1

I have a strange problem. I have a PHP script (witj js, ajax and etc) and it works on localhost very well. But on hosting in internet this script doesn't works. Script is below:

     $value = $_POST['web_url'];
        $tag = get_meta_tags("http://".$value);

        if(count($tag['keywords']) == 0)
        {
            echo "<div id='no_keywords'>No keywrds:</div>";
        }
        else
        {
            echo "<div id='title'>My keywords:</div>";
            echo "<br/>";
            print_r($tag['keywords']);
        }

For example, in localhost, when I enter: bbc.com - I get all list of keywords(ELSE construction works), but on hosting when I enter bbe.com - I get that 'there are no keywords'(IF construction works always)...Very strange...I don't understand why? Have you got any ideas? ((

3
  • In your question, you say you enter bbc.com on localhost but bbe.com on remote host; typo in the question, or actual error? Also, please post the code for get_meta_tags() so we can see how the remote website is loaded. Commented Sep 1, 2012 at 12:26
  • What is your host? SELinux on RH-Family of Linux typically blocks apache httpd from connecting to internet. Commented Sep 1, 2012 at 12:26
  • My host is 000webhost...and I can't open any url's... Commented Sep 1, 2012 at 13:57

1 Answer 1

2

Your Host server doesnt allow opening URLs: See http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen

Sign up to request clarification or add additional context in comments.

6 Comments

+1 for the most likely answer by far. This is a very common restriction that hosting companies put on PHP for security reasons. If they've turned it off and won't turn it on, you'll have to rewrite your code completely, or switch hosts.
I can't find, where to allow open URL on hosting panel. Or where can I do it?
For my testing site I used 000webhost - it's a free hosting with domain. What can you advise me? To use paid hosting?
Try phpinfo() in your php file and check allow_url_fopen
If your free hosting server doent allow it then there s no way you can turn it on
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.