Mercurial > hg > ywww
view examples/search/resultsSet.php @ 21:46382face560
use a semaphore to try to cut down on RequestThrottled fails
author | Charlie Root |
---|---|
date | Thu, 25 Oct 2018 09:42:12 -0400 |
parents | 077b0a0a3e6d |
children |
line wrap: on
line source
<?php class resultsSet { var $searchType; var $count; function __construct($type, $cnt) { include_once('constants.php'); $this->searchType = $type; $this->count = $cnt; } function getXMLResults($query){ $API = 'http://boss.yahooapis.com/ysearch/'.$this->searchType .'/v1/'; $request = $API . $query .'?format=xml&appid='. APP_ID . '&count=' . $this->count ; //echo $request; $ch = curl_init($request); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); $output = curl_exec($ch); curl_close($ch); //echo $output; $xml = simplexml_load_string ($output); return $xml; } }