473,396 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

posting array to an external php file

Ben
Hi,

I do use JPGraph for ploting some data.

I compute the data and generate to sets of DATA.

$X and $Y.

I have also written a plot.php file where run my plot.

What I want to do is something like below?

Dos anyone know it is possible? Cause I cannot post the Array values.

<img src=plot.php?X=$X&Y=$Y>

The plot.php sends the header as a PNG file and generate the plot.

Regards...

Jul 24 '05 #1
7 1901
Ben
BTW

When I do it like that it works. But sometimes array is long as 15000
numbers. So this would not be a clever idea.

I SEND
---------------------
print"<img src=\"plot_pdf.php?
Y=".urlencode(serialize($Y))."&
X=".urlencode(serialize($X))."\">";

I GET
-------------
$X = unserialize($_GET['X']);
$Y = unserialize($_GET['Y']);

Jul 24 '05 #2
This could be a really bad suggestion, but, could your script quickly write
the array to a .txt file which is read by the next website.

"Ben" <be*@ventusvigor.com> wrote in message
news:11********************@g49g2000cwa.googlegrou ps.com...
Hi,

I do use JPGraph for ploting some data.

I compute the data and generate to sets of DATA.

$X and $Y.

I have also written a plot.php file where run my plot.

What I want to do is something like below?

Dos anyone know it is possible? Cause I cannot post the Array values.

<img src=plot.php?X=$X&Y=$Y>

The plot.php sends the header as a PNG file and generate the plot.

Regards...

Jul 24 '05 #3

"luke" <ld*******@eml.nope> wrote in message
news:XG*******************@news.xtra.co.nz...
This could be a really bad suggestion, but, could your script quickly
write
the array to a .txt file which is read by the next website.


That's not a bad idea - and to get around the problem of the wrong data
going to the wrong viewer, perhaps using a random file name could help? PHP
has a function for creating a temp filename called "tempnam"

If the page that generates the img tag is php page that first generates the
data to be ploted, you could make your img tag something like:
<img src="plot.php?TMPA092e45xf" />

When plot displays the the file, at the end it could delete the temporary
file...
Jul 24 '05 #4
NC
Ben wrote:

I do use JPGraph for ploting some data.
I compute the data and generate to sets of DATA.
$X and $Y.
I have also written a plot.php file where run my plot.
What I want to do is something like below?

Dos anyone know it is possible? Cause I cannot post the Array values.

<img src=plot.php?X=$X&Y=$Y>
The plot.php sends the header as a PNG file and generate the plot.


There are several possible solutions to your problem:

1. Move the computation from its current location into plot.php
and pass to plot.php only the inputs necessary to make the
computation. This will have the best results if you don't
need to display the results of the computation in the HTML
you generate.

2. Record $X and $Y into a randomly-named text file, pass its
name to plot.php and make plot.php delete it after it has
read and verified the data.

3. Record $X and $Y into session variables.

Cheers,
NC

Jul 25 '05 #5


NC wrote (in part):
2. Record $X and $Y into a randomly-named text file, pass its
name to plot.php and make plot.php delete it after it has
read and verified the data.

3. Record $X and $Y into session variables.


Number 3 is the best option.

If you want to use a file, I suggest you look at the function tmpname()
<http://www.php.net/tmpname>. Then you can either pass the name on the
URL or use a session varible to pass the name.

Ken

Jul 25 '05 #6
Ben wrote:
<snip>
What I want to do is something like below?

Dos anyone know it is possible? Cause I cannot post the Array values.

<img src=plot.php?X=$X&Y=$Y>


FWIW, You may also pass the array via query string:
1. <img src="plot.php?X[]=1&Y[]=2&X[]=2&Y[]=4" />
2. <img src="plot.php?X[10]=1&Y[10]=2&X[4]=2&Y[4]=4" />

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com

Jul 25 '05 #7

Yes .. nice solution. I was thinking mainly about the problem with what do
with with the .txt file once it's been used. But that deletion would be very
nice. Another, slightly shitting way, could be a PHP script activated by a
cron job that purges files older than, say, and hour, that runs once a day
or so. ?

"Michael Phipps" <gr********************@optusnet.com.au> wrote in message
news:42***********************@news.optusnet.com.a u...

"luke" <ld*******@eml.nope> wrote in message
news:XG*******************@news.xtra.co.nz...
This could be a really bad suggestion, but, could your script quickly
write
the array to a .txt file which is read by the next website.
That's not a bad idea - and to get around the problem of the wrong data
going to the wrong viewer, perhaps using a random file name could help?

PHP has a function for creating a temp filename called "tempnam"

If the page that generates the img tag is php page that first generates the data to be ploted, you could make your img tag something like:
<img src="plot.php?TMPA092e45xf" />

When plot displays the the file, at the end it could delete the temporary
file...

Jul 26 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Trevor Stapleton | last post by:
I have an external javascript file named record.js in the file is the following sample: rec="Blake, Agnes, 18 Sep 1909"; rec="Boyes, Florence Edith, 1885"; rec="Carter, Kathleen Sybil, 1910";...
6
by: ku_coyote | last post by:
I have an external file, TestVar.js with a single line. NewsA("This is a test.","test.pdf","TEST") Within my HTML I wish to use the array variables from TestVar.js, but can't seem to get them...
0
by: jim4u | last post by:
I am porting a vb library to vb.net. The vb library has an external call to an unmanaged dll. Existing code: //External function declaration Private Declare Function Uncompress& Lib...
0
by: jim4u | last post by:
I am porting a vb library to vb.net. The vb library has an external call to an unmanaged dll. Existing code: //External function declaration Private Declare Function Uncompress& Lib...
13
by: Salvatore Di Fazio | last post by:
Hi, I've an array in an include that is used everywhere in the project. So to avoid the problem of declaration I made the following solution: ifndef __UNWALKABLETILES__ #define...
9
by: joshc | last post by:
Hi, I have an array defined in one file with an intializer as follows: int arr = {0, 1, 2, 3}; I have a declaration of the array in another file as follows: extern int arr;
4
by: teddarr | last post by:
Here's my quandry.....I am building a phone book program with student and staff classes. In main() I am to define 2 arrays 1 for students and 1 for staff. Each array will hold objects. I have...
3
by: gsuns82 | last post by:
HI all, I tried to read an array from an external javascript file called read.js,The array was declared & as well as defined with some values inside the <script> tag of a html file. For an...
15
by: mdh | last post by:
May I ask. If an array is defined , not as a static, but outside of a function, is there any guarantee as to the contents of each element? Thanks.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.