0

Off-site access restriction from on-site PHP

Hi Guys,
I am TRYING to access an external web server from my Yahoo hosted PHP script. I know the script is valid as I can easily run it from my localhost. But when I copy the script to my site hosted on Yahoo, the script fails, and I know it fails; whenever the file or file_get_contents PHP function is used. For example, $array = file('www.yahoo.com'); or $string = file_get_contents("www.google.com"); (Yahoo & Google are here only for example). I really get the feeling that there is a permissioning issue on my/all (?) Yahoo hosted sites. Or is it a Yahoo firewall? This is really concerning me as I want to access important information hosted on an external (from Yahoo) site. This is a real show stopper.
blink.gif
Urgent answer required (trex_4321 at yahoo dot com), if possible. Otherwise off to another hosting service.

by
3 Replies
  • QUOTE (info@... @ Nov 17 2009, 07:02 PM) <{POST_SNAPBACK}>
    Hi Guys,
    I am TRYING to access an external web server from my Yahoo hosted PHP script. I know the script is valid as I can easily run it from my localhost. But when I copy the script to my site hosted on Yahoo, the script fails, and I know it fails; whenever the file or file_get_contents PHP function is used. For example, $array = file('www.yahoo.com'); or $string = file_get_contents("www.google.com"); (Yahoo & Google are here only for example). I really get the feeling that there is a permissioning issue on my/all (?) Yahoo hosted sites. Or is it a Yahoo firewall? This is really concerning me as I want to access important information hosted on an external (from Yahoo) site. This is a real show stopper.
    :bhttp://www.sony-ak.com
    0
  • QUOTE (info@... @ Nov 17 2009, 07:02 PM) <{POST_SNAPBACK}>
    Hi Guys,
    I am TRYING to access an external web server from my Yahoo hosted PHP script. I know the script is valid as I can easily run it from my localhost. But when I copy the script to my site hosted on Yahoo, the script fails, and I know it fails; whenever the file or file_get_contents PHP function is used. For example, $array = file('www.yahoo.com'); or $string = file_get_contents("www.google.com"); (Yahoo & Google are here only for example). I really get the feeling that there is a permissioning issue on my/all (?) Yahoo hosted sites. Or is it a Yahoo firewall? This is really concerning me as I want to access important information hosted on an external (from Yahoo) site. This is a real show stopper.
    :bIn php.ini the "allow_url_fopen" value is changed to 0 (default is 1) causing file_get_contents(URL) to fail, affecting YAHOO! API access.
    0
  • QUOTE (rnd@... @ Nov 25 2009, 05:57 AM) <{POST_SNAPBACK}>
    In php.ini the "allow_url_fopen" value is changed to 0 (default is 1) causing file_get_contents(URL) to fail, affecting YAHOO! API access.


    I understand that, but I can't understand why curl doesn't work on external files.

    CODE
    function  getfile($url)
    {
    $ch = curl_init($url);
    $fp=fopen("catalog1.xml","w") or die("can't open catalog1.xml");
    curl_setopt($ch, CURLOPT_FILE, $fp);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
    curl_exec($ch);
    curl_close($ch);
    fclose($fp);
    }


    This function only works on files that fopen will work with not external files. Can't figure out why. Help!
    0

Recent Posts

in PHP Development