find('span.photo_container') as $element) { $item['href'] = 'http://flickr.com'.$element->find('a',0)->href; // Page URI $item['thumbnailUri'] = $element->find('img',0)->getAttribute('data-defer-src'); // Thumbnail URI $item['title'] = $element->find('a',0)->title; // Photo title $items[] = $item; } if(empty($items)) { returnError('404 Not Found', 'ERROR: no results.'); } $format = 'atom'; if (!empty($_GET['format'])) { $format = $_GET['format']; } switch($format) { case 'plaintext': case 'json': case 'atom': break; default: $format='atom'; } if($format == 'plaintext') { header('content-type: text/plain;charset=utf8'); print_r($items); exit; } if($format == 'json') { header('content-type: application/json'); $items = json_encode($items); exit($items); } if($format == 'atom') { header('content-type: application/atom+xml; charset=UTF-8'); echo ''."\n"; echo 'Flickr Explore'."\n"; echo 'http'.(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '')."://{$_SERVER['HTTP_HOST']}{$_SERVER['PATH_INFO']}".'/'."\n"; echo ''.date(DATE_ATOM, $tweets['0']['timestamp']).''."\n"; echo ''."\n"; echo ''."\n"."\n"; foreach($items as $item) { echo 'Flickrhttp://flickr.com/'."\n"; echo '<![CDATA['.$item['title'].']]>'."\n"; echo ''."\n"; echo ''.$item['href'].''."\n"; echo ''."\n"; // FIXME: date ??? echo ']]>'."\n"; echo ''."\n\n"; } echo ''; exit; } exit();