Mercurial > hg > ywww
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/search/resultsSet.php Thu Feb 16 22:29:02 2017 +0000 @@ -0,0 +1,27 @@ +<?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; + } + + }