Help - Search - Members - Calendar
Full Version: Online graph in website
HTMLHelp Forums > Programming > Server-side Scripting
rrn
hi all ,

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

graph is displayed . but the problem is that. whenever the graph changes in the 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 www.xxxx.com.

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

CODE
<? 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...
Brian Chandler
If the bit of PHP you have shown is in the page requested, then this will fetch the current version. It's hard to see how this would magically be the version from 3hours previously.

Why are you using CURL? Why not simply include a link to the original image in your page? If it is someone else's graph, you wouldn't be doing this to avoid acknowledging them, I suppose?

rrn
QUOTE(Brian Chandler @ Apr 19 2009, 08:00 AM) *

If the bit of PHP you have shown is in the page requested, then this will fetch the current version. It's hard to see how this would magically be the version from 3hours previously.

Why are you using CURL? Why not simply include a link to the original image in your page? If it is someone else's graph, you wouldn't be doing this to avoid acknowledging them, I suppose?


what should i use instead of CURL ? can you please make it clear??

Thanks
Brian Chandler
Suppose the address where this graph is to be found is http://somewhere/graphs/xxx.gif, then instead of a CURL call to fetch the data, save it as a file on your server, and include it as part of the page, you write:

<img src="http://somewhere/graphs/xxx.gif">

Usually this is much simpler. Incidentally, if you _do_ need to copy files to your server, in simple cases if you have the url_open (?) directive on, you can just use

copy($from, $to)

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.