Code: Select all
class example{
var $bookval;
function set_bookval($number){
$this->bookval=$number;
}
function mysql_bookval($ticker){
$url = "http://www.investor.reuters.wallst.com/stocks/Ratios.asp?rpc=66&ticker=".$ticker;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
$result = curl_exec($ch);
curl_close($ch);
$pattern='!Price to Book \(MRQ\)</span>\s*<span class="rb-company greycell">([^<]*)</span>!';
preg_match($pattern,$result,$bookval);
set_bookval($bookval[1]);
}
}I get a mean little error if i try calling another method in the same class. Any ideas????
Fatal error: Call to undefined function set_bookval() in /home/clinton/hdd1/coldowl/project/stock/tests/stock_class.php on line 82