PDA

View Full Version : Ajax Tabs Content: load external (not own domain) pages



jvidal
09-15-2006, 08:53 AM
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

jscheuer1
09-15-2006, 09:51 AM
Can't do it with Ajax.

blm126
09-15-2006, 11:18 AM
If you have a server-side language (like PHP,ASP,etc.) you can "bounce" the data off of a file on the local server.

jvidal
09-15-2006, 11:24 PM
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

blm126
09-16-2006, 04:04 PM
<?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