<!--<h2>Cool Console : <a href='http://developer.yahoo.com/yql/console/'>http://developer.yahoo.com/yql/console/</a></h2>-->
<?php
$url = "http://query.yahooapis.com/v1/public/yql?q=";
$q = "select * from flickr.photos.search(100) where text='hacku'";
$fmt = "xml";
$x = simplexml_load_file($url.urlencode($q)."&format=$fmt");
foreach($x->attributes('http://www.yahooapis.com/v1/base.rng') as $k=>$v) {
$$k=(string)$v;
}
echo <<<EOB
$count photos fetched from
{$x->diagnostics->url} in
{$x->diagnostics->url['execution-time']} seconds<br>
EOB;
$flickr = "http://static.flickr.com/";
foreach($x->results->photo as $p) {
echo "<img src=\"$flickr{$p['server']}/{$p['id']}_{$p['secret']}_s.jpg\"/>\n";
}
?>
Warning: simplexml_load_file(http://query.yahooapis.com/v1/public/yql?q=select+%2A+from+flickr.photos.search%28100%29+where+text%3D%27hacku%27&format=xml) [function.simplexml-load-file]: failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request
in /var/www/paul.slowgeek.com/hacku/examples/yql-flickr.php on line 7
Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "http://query.yahooapis.com/v1/public/yql?q=select+%2A+from+flickr.photos.search%28100%29+where+text%3D%27hacku%27&format=xml" in /var/www/paul.slowgeek.com/hacku/examples/yql-flickr.php on line 7
Fatal error: Call to a member function attributes() on a non-object in /var/www/paul.slowgeek.com/hacku/examples/yql-flickr.php on line 9