i am having a class in some functions in this class. all the functions have variables. the code is written below
<?php
class myclass{
public function getresults{
$url = 'http://www.slideshare.net/api/2/search_slideshows?q=google';
echo $url;
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Your application name');
$query = curl_exec($ch);
$errorCode = curl_errno($ch);
curl_close($ch);
$array = (array) simplexml_load_string($query);
//echo '<pre>';
//print_r($array);
public $TotalResults;
$TotalResults = $array['Meta']->TotalResults;
echo "function is correct";
}
}
when i call this fun
echo $obj1->TotalResults;
this gives error to me. please help me and modify my code.