SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question get xml from a http://www. not current directory?

    What i'm wondering is if there's any way to get xml file data from a -> xmlhttp.open("GET","http://www.website.com/file.xml",false);
    than xmlhttp.open("GET","file.xml",false); ?

  2. #2
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The current code is
    Code:
    xmlhttp.open("GET","http://www.mysite.com/xml/file.xml",false);
    xmlhttp.send();
    and it works, but when i enter
    Code:
    xmlhttp.open("GET","http://www.someothersite.com/directoryxxx/file.xml",false);
    xmlhttp.send();
    it doesnt show any content.
    Can anyone please help, on this or is it possible to show content from xml content from different location other than local?

  3. #3
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,192
    Mentioned
    191 Post(s)
    Tagged
    2 Thread(s)
    AJAX has same domain restrictions for security reasons.

    Maybe you can do something server-side? Maybe using CURL?

  4. #4
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for answering. Restrictions might explain but, i have no idea on how to use CURL for that. I googled but it's still confusing.

  5. #5
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,192
    Mentioned
    191 Post(s)
    Tagged
    2 Thread(s)
    What are you using server side, PHP?

    If so, and if the allow_url_fopen settng is enabled you should have a few options.

    *note: - to find out you can run
    HTML Code:
    <?php
    phpinfo();
    ?>

  6. #6
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, i'm using php and the allow_url_fopen is enabled.

  7. #7
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I got it to work by making everything in php.
    I called the xml data through php not html and javascript and it all works.
    Only thing i need to find out no is how to display top 10 results of xml.

    Thanks for help.


Bookmarks

Posting Permissions

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