The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Online graph in website
rrn
post Apr 19 2009, 05:49 AM
Post #1


Novice
**

Group: Members
Posts: 21
Joined: 15-April 09
Member No.: 8,330



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...
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Apr 19 2009, 08:00 AM
Post #2


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



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?

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
rrn
post Apr 20 2009, 05:13 AM
Post #3


Novice
**

Group: Members
Posts: 21
Joined: 15-April 09
Member No.: 8,330



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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Apr 20 2009, 06:06 AM
Post #4


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



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)

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 29th March 2024 - 08:37 AM