开发者

Zend and google fusion table

I have a fusion table containing postcode开发者_StackOverflow社区s. I'm trying to access it using PHP.

After hours, I've managed to get something display (Select) using Zend. I'm now able to display the body of the Http response.

But I can't find a way to do a 'foreach' for each postcode (I need to update another column for each postcode).

My code:

$data = $gdata->get($url);

$postcodes = $data->getRawBody();   
foreach ($postcodes as $codes)
{
    echo "postcode: ". $codes. "<br/>";
}

echo "<pre>";
var_dump($postcodes);
echo "</pre>\n";

So, the foreach returns an error: Warning: Invalid argument supplied for foreach() in

And the dump: string(147555) "name AB10 1 AB10 6 AB10 7 AB11 5 AB11 6 AB11 7 AB11 8 AB11 9 AB12 3


Managed to solve it

$postcodes = $data->getRawBody(); 
$codes = split ( "\n", $postcodes);

foreach ($codes as $entry) 
{ 
    echo "postcode:" . $entry . "<br/>"; 
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜