469,623 Members | 1,535 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,623 developers. It's quick & easy.

how to pass an xml string as a get parameter

I want to send an xml string as a get parameter,
where the xml is created from a runtime
database query. I try to avoid dynamic framesets,
but sometimes they're needed:

$xml = mysql_stuff($x,$y,$z);
echo "<frameset...>";
echo "<frame src=".$PHP_SELF."?xml=".$xml.">";
snip....

That didn't work, so I tried urlencoding various pieces:
$xmlstr = urlencode($xml);
echo "<frameset .....>";
echo "<frame src=".$PHP_SELF."%3Fxml=".$xmlstr.">"

.....then, at the other end of the recursive pipe:
$encodedXML = $_GET['xml'];
$xml = urldecode($encodedXML);

But that causes trouble too.
I suppose I could serialize the xml and save it
as a session variable. There must be a way to pass
XML as a parameter, from one php process to another.
Jul 17 '05 #1
5 7412
"Salmo Bytes" <de*****@montana-riverboats.com> wrote in message
news:a8**************************@posting.google.c om...
I want to send an xml string as a get parameter,
where the xml is created from a runtime
database query. I try to avoid dynamic framesets,
but sometimes they're needed:

$xml = mysql_stuff($x,$y,$z);
echo "<frameset...>";
echo "<frame src=".$PHP_SELF."?xml=".$xml.">";
snip....

That didn't work, so I tried urlencoding various pieces:
$xmlstr = urlencode($xml);
echo "<frameset .....>";
echo "<frame src=".$PHP_SELF."%3Fxml=".$xmlstr.">"

....then, at the other end of the recursive pipe:
$encodedXML = $_GET['xml'];
$xml = urldecode($encodedXML);

But that causes trouble too.
I suppose I could serialize the xml and save it
as a session variable. There must be a way to pass
XML as a parameter, from one php process to another.


Why would you need to serialize the xml? It's already a string.

In this case the obvious answer is to pass $x, $y, and $z on the URL and
then retrieve the XML data from the database.
Jul 17 '05 #2
"Chung Leong" <ch***********@hotmail.com> wrote in message news:<-4********************@comcast.com>...
"Salmo Bytes" <de*****@montana-riverboats.com> wrote in message
news:a8**************************@posting.google.c om...
I want to send an xml string as a get parameter,
where the xml is created from a runtime
database query. I try to avoid dynamic framesets,
but sometimes they're needed:

$xml = mysql_stuff($x,$y,$z);
echo "<frameset...>";
echo "<frame src=".$PHP_SELF."?xml=".$xml.">";
snip....

That didn't work, so I tried urlencoding various pieces:
$xmlstr = urlencode($xml);
echo "<frameset .....>";
echo "<frame src=".$PHP_SELF."%3Fxml=".$xmlstr.">"

....then, at the other end of the recursive pipe:
$encodedXML = $_GET['xml'];
$xml = urldecode($encodedXML);

But that causes trouble too.
I suppose I could serialize the xml and save it
as a session variable. There must be a way to pass
XML as a parameter, from one php process to another.
Why would you need to serialize the xml? It's already a string.


That was a guess: $xml = $_GET['xml'] doesn't retrieve the string
in useable format.
In this case the obvious answer is to pass $x, $y, and $z on the URL and
then retrieve the XML data from the database.


....because I want to have a page generation module that isn't
tied to mysql, so I can gather xml from any source and then transform
that into html on the fly.

I think I've figured out how to use Smarty Template to do what I want.
Jul 17 '05 #3
"Salmo Bytes" <de*****@montana-riverboats.com> wrote in message
news:a8**************************@posting.google.c om...
...because I want to have a page generation module that isn't
tied to mysql, so I can gather xml from any source and then transform
that into html on the fly.


There are far better ways of keeping database code from mingling with
interface code. The simplest would be to write a function.

Passing page content on the URL is always wrong, because you're letting the
world+dog modify your site. I could fashion a URL with an XML containing,
say, a something about killing the US president, then dump the URL into
Google. Now anyone who chance upon that page will think that you want to
kill the pres.
Jul 17 '05 #4

Chung Leong wrote:
Passing page content on the URL is always wrong, because you're letting the world+dog modify your site.


Fine, but I'm not passing page content...only a few parameters,
collected however I want, and then passed around in xml format--it's a
convenient way to pass small but variable length lists of layout
parameters, server-side handles to images, text files etc. I can
specify
what eventually becomes a hundred lines of html in a dozen lines of xml
(I'm not talking about xslt)...I have my own ways of doing that.

The inherently predictable nature of XML makes it possible to
dynamically generate automatically operational data entry and data
query
GUI screens. That's the real reason to use XML as a parameter transport

mechanism. GUI screens that operate over relational data inevitably
require
manual, hand coded programming time. XML data can be manipulated by
entirely machine generated interfaces.

Take a look at http://neurosys.cns.montana.edu....to see a more
elaborate argument for using xml as a data transport mechanism.

Jul 17 '05 #5
I think what you want to do is use cURL - this enables you to pass
get and post statements via Curl, then you can parse the resonse from
the xml server, and use the variables in an object.

Phil

"castnblast" <de*****@montana-riverboats.com> wrote in message news:<10*********************@c13g2000cwb.googlegr oups.com>...
Chung Leong wrote:
Passing page content on the URL is always wrong, because you're

letting the
world+dog modify your site.


Fine, but I'm not passing page content...only a few parameters,
collected however I want, and then passed around in xml format--it's a
convenient way to pass small but variable length lists of layout
parameters, server-side handles to images, text files etc. I can
specify
what eventually becomes a hundred lines of html in a dozen lines of xml
(I'm not talking about xslt)...I have my own ways of doing that.

The inherently predictable nature of XML makes it possible to
dynamically generate automatically operational data entry and data
query
GUI screens. That's the real reason to use XML as a parameter transport

mechanism. GUI screens that operate over relational data inevitably
require
manual, hand coded programming time. XML data can be manipulated by
entirely machine generated interfaces.

Take a look at http://neurosys.cns.montana.edu....to see a more
elaborate argument for using xml as a data transport mechanism.

Jul 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Zlatko Matić | last post: by
1 post views Thread by Dion Heskett | last post: by
3 posts views Thread by Brett | last post: by
5 posts views Thread by David++ | last post: by
3 posts views Thread by Bob Speaking | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.