henüz yeni class yapılarına girdim ilk yaptığım deneme bu o yüzden şekillendirmesi sana kalmış şu durumda verdiği çıktı şöyle
Backlink: 651
Index: 566
class dosyamız
class veriCek
{
public $adres = null;
public $veri;
public $hata = array();
public function googleBacklink($adres)
{
$this->adres = $adres;
$this->veri = file_get_contents('http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=site%3A'.$this->adres);
$this->veri = json_decode($this->veri);
$son = $this->veri->responseData->cursor->estimatedResultCount;
if(!empty($son)) {
return $son;
} else {
return $son = 0;
}
}
public function googleIndex($adres)
{
$this->adress = $adres;
$this->veris = file_get_contents('http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=link%3A'.$this->adress);
$this->veris = json_decode($this->veris);
$son = $this->veris->responseData->cursor->estimatedResultCount;
if(!empty($son)) {
return $son;
} else {
return $son = 'Sonuç Yok';
}
}
}index sayfamız
require_once('baglanti.sinif.php');
$adres = 'http://www.mynet.com';
$data = new veriCek();
print 'Backlink: '.$data->googleBacklink($adres).'<br />';
print 'Index: '.$data->googleIndex($adres);