Mercurial > hg > ywww
comparison examples/search/resultsSet.php @ 6:077b0a0a3e6d
remaining originals according to dependency walk
| author | Robert Boland <robert@markup.co.uk> |
|---|---|
| date | Thu, 16 Feb 2017 22:29:02 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 5:55445b456ad0 | 6:077b0a0a3e6d |
|---|---|
| 1 <?php | |
| 2 class resultsSet { | |
| 3 var $searchType; | |
| 4 var $count; | |
| 5 | |
| 6 function __construct($type, $cnt) { | |
| 7 include_once('constants.php'); | |
| 8 $this->searchType = $type; | |
| 9 $this->count = $cnt; | |
| 10 } | |
| 11 | |
| 12 function getXMLResults($query){ | |
| 13 $API = 'http://boss.yahooapis.com/ysearch/'.$this->searchType .'/v1/'; | |
| 14 $request = $API . $query .'?format=xml&appid='. APP_ID . '&count=' . $this->count ; | |
| 15 //echo $request; | |
| 16 | |
| 17 $ch = curl_init($request); | |
| 18 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
| 19 curl_setopt($ch, CURLOPT_HEADER, 0); | |
| 20 $output = curl_exec($ch); | |
| 21 curl_close($ch); | |
| 22 //echo $output; | |
| 23 $xml = simplexml_load_string ($output); | |
| 24 return $xml; | |
| 25 } | |
| 26 | |
| 27 } |
