Mercurial > hg > ywww
view examples/search/resultsSet.php @ 10:5aa24c984a3b
if no code show entire response
author | Henry S. Thompson <ht@markup.co.uk> |
---|---|
date | Sat, 18 Feb 2017 12:28:36 +0000 |
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; } }