im trying to have a good practice at abstract class Methods so i created a simple curl wrapper class but unfortunately it doesn't work .
abstract
<?php
abstract class curl{
private $url;
public function __construct($url){
$this->url = $url ;
}
public function curl_grab_page()
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_URL, $this->url);
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
ob_start(); // prevent any output
return curl_exec ($ch); // execute the curl command
ob_end_clean(); // stop preventing output
curl_close ($ch);
}
public abstract function getHTML();
}
?>
child
<?php
class google extends curl{
private $url;
function __construct($url) {
parent::__construct($url);
}
function curl_grab_page(){
parent::curl_grab_page();
}
function getHTML(){
return $this->curl_grab_page();
}
}
and this is how i call in my front page .
<?php
include 'classes/class.curl.php';
include 'classes/class.google.php';
$google = new google('http://www.google.com/');
echo $google->getHTML();
?>
it didn't print out anything .
i tried the function separately and it goes fine