PHP regular retrieval of JS-generated content for SEO purposes?
I thought I read in a tutorial on YQL by Chris Heilmann that if you're generating any content client-side with JSON, you should include a server-side function to generate the content at regular intervals for search engines to find. (I wish I could find the reference back.) Is that true, and if so,开发者_如何学编程 what is a PHP way to run this JSON function once a week for search bots?
$.getJSON('http://query.yahooapis.com/v1/public/yql?q=this%20*%20is%20query&format=json&callback=',
function (data) {
$.each(data.query.results.row, function (i, item) {
$("table#results")
.append('<tr><td class="color">' + item.color + '</td><td class="size">' + item.size + '</td><td class="brand">' + item.brand + '</td></tr>');
});
I found the reference (last line)
A commenter provides this PHP, the HTML got stripped in the comment:
<?php
$sCSVfile = 'https://spreadsheets.google.com/pub?key=12345678&hl=en&output=csv';
if (($handle = fopen($sCSVfile, "r")) !== FALSE)
{
while (($aCSVdata = fgetcsv($handle, 1000, ",")) !== FALSE)
{
echo '‘ . $aCSVdata[0] . ‘‘ . PHP_EOL;
echo ‘‘ . $aCSVdata[1] . ‘‘ . PHP_EOL;
}
fclose($handle);
}
?>
But it's either/or, right? Either PHP or JS/JSON?
精彩评论