Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CGI parameter passing question.

Status
Not open for further replies.

cbatrano

Programmer
Jan 30, 2003
1
US
I'm creating graphs on the fly in PERL and I'm embedding the plot data in the URL of the graph generator like the following:

# Print the graph.
#
print &quot;<img width=400 height=400 src=\&quot;graph.cgi?$width&$height&$plot_data\&quot;>&quot;;

My problem is, as I generate graphs with higher resolutions I start getting &quot;URL too long&quot; errors. Is there another method of passing information to a script or a way to increase the allowable length of a URL?

Thankyou,
Chris
 
LWP::UserAgent creates http requests. You might be able to modify you approach a little and employ the LWP module.

'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
 
This is a long shot, but maybe using a scientific notation to pass the parameter or a mathamatical funcition support by Javascript that you can undo on the server side. Like maybe taking the log of the number and snipping off the decimal portion.

Good question anyone else?
 
The problem is that the query string is limited to 255 bytes. If you absolutely have to call the CGI via an image tag, then one solution is to use JavaScript client-side or Perl server-side to implement a simple compression algorithm such as Huffman, and then print the image tag with the resulting compressed data, uncompressing it again in your CGI code. It may be possible using this method to squeeze 500+ bytes into the query string. Alternatively, you can use a POST instead of a GET, and include the data in a form -- perhaps a hidden field with a SUBMIT button. Another method would be to display the image in an IFRAME or DIV populated from an invisible frame, and use a JavaScript automated submit to POST the data, thus showing the image without the additional SUBMIT step. Finally, you could save the image to a temporary file and display that instead. Sincerely,

Tom Anderson
Order amid Chaos, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top