开发者

PHP regular retrieval of JS-generated content for SEO purposes?

开发者 https://www.devze.com 2023-02-12 06:28 出处:网络
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 inter

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号