473,414 Members | 1,599 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,414 software developers and data experts.

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 7683
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Belinda | last post by:
Hello All I have the following test.asp page which needs one parameter querystr but my querystr is a very long string value. When I send a long value the query string is getting truncated after...
7
by: Zlatko Matić | last post by:
Let's assume that we have a database on some SQL server (let it be MS SQL Server) and that we want to execute some parameterized query as a pass.through query. How can we pass parameters to the...
0
by: Zlatko Matić | last post by:
Hi everybody! Recently I was struggling with client/server issues in MS Access/PostgreSQL combination. Although Access is intuitive and easy to use desktop database solution, many problems...
1
by: Dion Heskett | last post by:
How can I pass a Class as a parameter to in a method ? i.e. Private myMethod( string pram1, Classobject as pram2) { Classobject.DataSource = reader; Classobject.DataBind(); }
5
by: Fresh Air Rider | last post by:
Hello Could anyone please explain how I can pass more than one arguement/parameter value to a function using <asp:linkbutton> or is this a major shortfall of the language ? Consider the...
21
by: vmsgman | last post by:
Here is a code sample ... int blah = ReadFile( defArray, defFileName, w, h); // Read File Contents into memory array and return for processing public int ReadFile( ref ushort nArray, string...
3
by: Brett | last post by:
I have several classes that create arrays of data and have certain properties. Call them A thru D classes, which means there are four. I can call certain methods in each class and get back an...
5
by: David++ | last post by:
Hi folks, I would be interested to hear peoples views on whether or not 'pass by reference' is allowed when using a Web Service method. The thing that troubles me about pass-by-reference into...
3
by: Bob Speaking | last post by:
Hi at all, Is possible to pass a parameter though a delegate or to override it? (I'm newbie and I'm trying to understand delegates and their use in a real scenario) In my scenario I need to...
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.