Page 1 of 1

Online graph in website

Posted: Sun Apr 19, 2009 5:52 am
by rrn
hi all ,

in my website there is a graph showing some values . that graph is taken from some other site named http://www.xxxx.com

graph is displayed . but the problem is that. whenever the graph changes in the http://www.xxxx.com , the change should also reflect in my website.

change is reflected but only after 3 , 4 hours after the graph changes in http://www.xxxx.com.

the change should be reflected at once , how is it possible?
below shown is the code for updating the graph

Code: Select all

<? php
$ch = curl_init("http://www.xxxx.com");
$fp = fopen("location where it is saved", "w");
 
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
 
curl_exec($ch);
curl_close($ch);
fclose($fp);
?>


please give a solution..thanks..

Re: Online graph in website

Posted: Sun Apr 19, 2009 8:24 am
by jazz090
instead of using curl, trying capturing the data using a cron every hour or so into a mysqldb or sqlite, then simple access that data when u need it.

Re: Online graph in website

Posted: Mon Apr 20, 2009 10:20 am
by pickle
why not just reference the graph directly using an <img> tag?