PHP Classes

edit class

Recommend this page to a friend!

      Google News  >  All threads  >  edit class  >  (Un) Subscribe thread alerts  
Subject:edit class
Summary:edit class
Author:mustafa hamad
Date:2011-12-21 09:36:38

  1. edit class   Reply   Report abuse  
Picture of mustafa hamad mustafa hamad - 2011-12-21 09:36:38
// Gogle news search api
# implemented by Amit Kumar Gaur
// Email :
# blog:
class GoogleNews {
public $ans;
public function __construct($ww) {
$url = "".$ww;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, "");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$this->ans= curl_exec($ch);

$searchWord="mustafa hamad";
$gn=new GoogleNews($qq);
$outPut = json_decode($gn->ans);
foreach($outPut->responseData->results as $p) {
echo "<hr>";
echo "<br>".$p->GsearchResultClass;
echo "<br>".$p->clusterUrl;
echo "<br>".$p->content;
echo "<br>".$p->unescapedUrl;
echo "<br>".$p->url;
echo "<br>".$p->image->url;
echo "<br>".$p->image->tbUrl;
echo "<br>".$p->image->originalContextUrl;

echo "<hr>";
foreach($outPut->responseData->results as $r) {
foreach($r->relatedStories as $rr){
echo "<br>".$rr->unescapedUrl;
echo "<br>".$rr->url;