pipes_fetch

Definition

pipes_fetch($pipe, $location = NULL, $keywords = NULL)
pipes/pipes.module, line 197

Description

Get a pipe from Yahoo!

Code

function pipes_fetch($pipe, $location = NULL, $keywords = NULL) {
  $cache = cache_get('pipe:'. $pipe->pid . ":l:$location:k:$keywords", 'cache');
  $data = unserialize($cache->data);
  if (empty($data)) {
    $url = $pipe->url  . "&location=$location&keywords=$keywords&_render=json";
    $file = file_get_contents($url);
    $data = json_decode($file, TRUE);
    cache_set('pipe:' . $pipe->pid . ":l:$location:k:$keywords", 'cache', serialize($data));
  }
  return $data;
}