Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Jun 2008
    Posts
    29
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Getting external XML data

    I am using Yahoo! BOSS search to generate the search for my site, but I'm having trouble getting the data from the XML file.

    The search is done on yahoo's site, boss.yahooapis.com, and I need to get information from their site to mine.

    The way I am trying to get the information is by using fopen("URL_HERE", "r");

    But when I load the page with the search, a PHP error comes up saying:
    Code:
    URL file-access is disabled in the server configuration in [my directory] on line 35
    How could I fixed this or do a workaround? I'm not sure I can change my server configuration because I am using subdomain hosting.

  • #2
    Master Coder mlseim's Avatar
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,389
    Thanks
    8
    Thanked 1,077 Times in 1,068 Posts
    Your webhost does not allow "fopen" ... this is for security reasons.
    An alternate way (that they most likely recommend is PHP CURL method).

    See this example script on how to read an XML file using CURL.
    It's all about reading an XML file to get the weather conditions,
    but the idea is the same. In fact, you can copy and put this
    script on your website to test it out.

    http://www.catpin.com/weather

    For more information about CURL, search Google for: PHP CURL tutorial

  • #3
    New Coder
    Join Date
    Jun 2008
    Posts
    29
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Seems like the right choice, but now I get the error message:
    Fatal error: Call to undefined function curl_init() in /home/www/[my_directory]/search.php on line 3
    Is this because my server might have an out-of-date PHP version?
    Last edited by itsjareds; 07-25-2008 at 01:17 AM.

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    No, it means you don't have the libcurl library installed. I don't do a lot of remote work, but the only ones I've used are fopen and curl, so without either I'm not certain you have a workaround besides finding a new host of course.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #5
    Master Coder mlseim's Avatar
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,389
    Thanks
    8
    Thanked 1,077 Times in 1,068 Posts
    You need to have PHP5 for CURL.

  • #6
    Senior Coder djm0219's Avatar
    Join Date
    Aug 2003
    Location
    Wake Forest, North Carolina
    Posts
    1,285
    Thanks
    4
    Thanked 201 Times in 198 Posts
    Not true mlseim. cURL support was added in PHP 4.0.2.
    Dave .... HostMonster for all of your hosting needs

  • #7
    Master Coder mlseim's Avatar
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,389
    Thanks
    8
    Thanked 1,077 Times in 1,068 Posts
    Dave ... you are right ... I just read documentation with my webhost ...
    they didn't have it enabled with PHP4, but they did with PHP5. That's when
    they turned off "fopen" -- nobody can enable that, even with php.ini

    [or they didn't have the library installed or enabled?]

    Anyhow, cURL now works fine for me (with PHP5).

    I guess each webhost sort of does their own thing.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •