how to pass an xml string as a get parameter

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Salmo Bytes

    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=".$xml str.">"

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

    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

    #2
    Re: how to pass an xml string as a get parameter

    "Salmo Bytes" <devnull@montan a-riverboats.com> wrote in message
    news:a8c6175f.0 410272135.6e1a1 4ac@posting.goo gle.com...[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=".$xml str.">"
    >
    > ....then, at the other end of the recursive pipe:
    > $encodedXML = $_GET['xml'];
    > $xml = urldecode($enco dedXML);
    >
    > 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.


    Comment

    • Salmo Bytes

      #3
      Re: how to pass an xml string as a get parameter

      "Chung Leong" <chernyshevsky@ hotmail.com> wrote in message news:<-4OdnQXJKYSKFh3c RVn-pQ@comcast.com> ...[color=blue]
      > "Salmo Bytes" <devnull@montan a-riverboats.com> wrote in message
      > news:a8c6175f.0 410272135.6e1a1 4ac@posting.goo gle.com...[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=".$xml str.">"
      > >
      > > ....then, at the other end of the recursive pipe:
      > > $encodedXML = $_GET['xml'];
      > > $xml = urldecode($enco dedXML);
      > >
      > > 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.

      Comment

      • Chung Leong

        #4
        Re: how to pass an xml string as a get parameter

        "Salmo Bytes" <devnull@montan a-riverboats.com> wrote in message
        news:a8c6175f.0 410280514.1af8e ae7@posting.goo gle.com...[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.


        Comment

        • castnblast

          #5
          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.

          Comment

          • Phil Palmieri

            #6
            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@montan a-riverboats.com> wrote in message news:<109901474 1.481055.11650@ c13g2000cwb.goo glegroups.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]

            Comment

            Working...