Connecting Tech Pros Worldwide Forums | Help | Site Map

how to pass an xml string as a get parameter

Salmo Bytes
Guest
 
Posts: n/a
#1: Jul 17 '05
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.

Chung Leong
Guest
 
Posts: n/a
#2: Jul 17 '05

re: how to pass an xml string as a get parameter


"Salmo Bytes" <devnull@montana-riverboats.com> wrote in message
news:a8c6175f.0410272135.6e1a14ac@posting.google.c om...[color=blue]
> 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.[/color]

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.


Salmo Bytes
Guest
 
Posts: n/a
#3: Jul 17 '05

re: how to pass an xml string as a get parameter


"Chung Leong" <chernyshevsky@hotmail.com> wrote in message news:<-4OdnQXJKYSKFh3cRVn-pQ@comcast.com>...[color=blue]
> "Salmo Bytes" <devnull@montana-riverboats.com> wrote in message
> news:a8c6175f.0410272135.6e1a14ac@posting.google.c om...[color=green]
> > 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.[/color]
>
> Why would you need to serialize the xml? It's already a string.[/color]

That was a guess: $xml = $_GET['xml'] doesn't retrieve the string
in useable format.
[color=blue]
> 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.[/color]

....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.
Chung Leong
Guest
 
Posts: n/a
#4: Jul 17 '05

re: how to pass an xml string as a get parameter


"Salmo Bytes" <devnull@montana-riverboats.com> wrote in message
news:a8c6175f.0410280514.1af8eae7@posting.google.c om...[color=blue]
> ...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.[/color]

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.


castnblast
Guest
 
Posts: n/a
#5: Jul 17 '05

re: how to pass an xml string as a get parameter



Chung Leong wrote:
[color=blue]
> Passing page content on the URL is always wrong, because you're[/color]
letting the[color=blue]
> world+dog modify your site.[/color]

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.

Phil Palmieri
Guest
 
Posts: n/a
#6: Jul 17 '05

re: how to pass an xml string as a get parameter


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" <devnull@montana-riverboats.com> wrote in message news:<1099014741.481055.11650@c13g2000cwb.googlegr oups.com>...[color=blue]
> Chung Leong wrote:
>[color=green]
> > Passing page content on the URL is always wrong, because you're[/color]
> letting the[color=green]
> > world+dog modify your site.[/color]
>
> 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.[/color]
Closed Thread