Results 1 to 5 of 5

Thread: Ajax Tabs Content: load external (not own domain) pages

  1. #1
    Join Date
    Sep 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Wink Ajax Tabs Content: load external (not own domain) pages

    1) Script Title: Ajax Tabs Content

    2) Script URL (on DD) : http://dynamicdrive.com/dynamicindex17/ajaxcontent.htm

    3) Describe problem : (thanks for the great job)

    I am trying to load external pages from other domain in a div -or similar-. I can't use iframes. Reading some messages, I understand that Ajax security don't allow such operations. Do you know any url or suggestions about it?. Any comments will be very appreciated (my engilsh is not so good...). Thanks in advance

    Joan

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Can't do it with Ajax.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    If you have a server-side language (like PHP,ASP,etc.) you can "bounce" the data off of a file on the local server.

  4. #4
    Join Date
    Sep 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Thanks

    Thanks both.

    I see it's not possible witj Ajax, but really I was not sure about the possibilities.

    About using asp or php, it's a little misterious for me, because ther's a page with a form which interact with a mysql database, and it looks like complicated for me -I did not programm it-. Anyway, I will try some tests in php.

    Thanks

    Joan

  5. #5
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    PHP Code:
    <?php
        
    if(empty($_GET['url'])){
            exit(
    'File does not exist');
        }
        
    $url $_GET['url'];
        
    $http substr($url,0,7);
        if(
    $http != 'http://'){
            
    //Possible hacking attempt
            
    exit('Only external files may be accessed');
        }
        @
    readfile($url) or exit('File could not be accessed');
    ?>
    That code will do wnat you want. Save it as getcon.php and then say you wanted to access google.com instead access getcon.php?url=http://www.google.com

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
  •