tags:

views:

224

answers:

4

i want to load contents of external url like (http://www.google.com) into div,

i the way which will readable by search engine crawl.

in any one of (jquery / ajax / php )

Thanks

A: 

If you want to actually display that website, you need to be using an iframe.

If you want to scrape the content and then display it yourself, there's tons of ways. cURL, file_get_contents(), all will do the trick.

Citizen
+1  A: 

Hi. Search indexing spiders typically work by viewing the "static" portions of your site. Any content loaded via JavaScript techniques (ajax, jQuery, etc.) will not work.

You can, however, use PHP to load an external site by using the file() function.

jkndrkn
if i use iframe, does search engine spiders read this ?
air
I have no personal experience with this. A quick googling of the topics "iframe search engine spider" and "iframe seo" revealed lots of contradicting information. My guess is that Google has not released an official statement on this. If you are looking to include off-site content for SEO purposes, I would argue against using this practice since Google's search guidelines specify that webmasters should strive to populate their site with unique (non-duplicate) content.
jkndrkn
+1  A: 

As others have mentioned, iFrame content won't be indexed, nor will content loaded with JavaScript. This is a good thing, though – it prevents you from getting docked for having duplicate content. As a technical example, though....

<?
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
echo $result;
?>

Curl is MUCH better at this than file_get_contents and it's faster than using sockets too (there is overhead associated with opening and reading sockets in PHP...libcurl does it at a closer-to-native level, which makes it faster overall...I've tested this significantly).

coreyward
A: 

This one open the whole page on the div called this_div. ANSWER1: $('this_div').load("www.google.com"); This one open the page and load the specific div of the url with a div called external to this_div. ANSWER1: $('this_div').load("www.sample.com #external");

kim edgard