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

Transferring variables between seperate hosts

This may be a dumb question but can you tranfer variables stored in a PHP
page on one server to a page on a different server via a form POST and be
able to access those variables on the new page using Perl? From my
understanding of HTTP I can't see why this should be a problem but it does
not seem to work at the moment although I am sure it is not a scripting
error at this stage

(Any newbie-level explanations welcomed!!)

Thanks
Mark



Jul 19 '05 #1
10 3590
Yes, it's possible. In the form tag of the PHP/HTML page on server1,
define the action value as URL to the second server, like this:

<form action="http://server2.com/process.cgi">

That's it...or did I misunderstand the question?

-Sauli Karhu

Mark wrote:
This may be a dumb question but can you tranfer variables stored in a PHP
page on one server to a page on a different server via a form POST and be
able to access those variables on the new page using Perl? From my
understanding of HTTP I can't see why this should be a problem but it does
not seem to work at the moment although I am sure it is not a scripting
error at this stage

(Any newbie-level explanations welcomed!!)

Thanks
Mark



Jul 19 '05 #2
Mark wrote:
This may be a dumb question but can you tranfer variables stored in a PHP
page on one server to a page on a different server via a form POST and be
able to access those variables on the new page using Perl? From my
understanding of HTTP I can't see why this should be a problem but it does
not seem to work at the moment although I am sure it is not a scripting
error at this stage

(Any newbie-level explanations welcomed!!)

Thanks
Mark


The answer to your question is "it depends".

Can you show us the relevant code snipettes and any error messages being
produced and a brief description of what you are trying to accomplish. There is
always more than one way to achieve the same outcome - and being a "newbie",
you may have picked the most difficult solution :)

--
Michael Austin.
Consultant - Available.
Donations welcomed. Http://www.firstdbasource.com/donations.html
:)
Jul 19 '05 #3
Mark wrote:
This may be a dumb question but can you tranfer variables stored in a PHP
page on one server to a page on a different server via a form POST and be
able to access those variables on the new page using Perl?


1) The usual way of sending variable values from a PHP (or even a plain HTML)
page to the browser is by using a <FORM> tag and several <INPUT> tags.

2) The browser can respond to the ACTION= part of the <FORM> tag and
send modified, unmodified, or hidden values to the target server.

3) CGI programs written in any language can parse input from the POSTed
form and use the values.

Get the third step working first. Then it should be trivial to do
the first step.
-Joe
Jul 19 '05 #4
If you post some code, we can disect it a bit. I would start by getting a
simple version working. As someone already suggested, get the parsing in
perl down first. Then point your php page in the direction of the perl
script and you should be in business. I would make the first perl script
just parse and print out the variable just so you know it got there. Heck,
you can even get the perl script to write more php code for you if you want.
Fun stuff - maybe sloppy, but fun.

Shane
"Mark" <no*******@fakoaddresso.como> wrote in message
news:MJ*******************@fe2.news.blueyonder.co. uk...
This may be a dumb question but can you tranfer variables stored in a PHP
page on one server to a page on a different server via a form POST and be
able to access those variables on the new page using Perl? From my
understanding of HTTP I can't see why this should be a problem but it does
not seem to work at the moment although I am sure it is not a scripting
error at this stage

(Any newbie-level explanations welcomed!!)

Thanks
Mark


Jul 19 '05 #5
No you didn't misunderstand as that's pretty much how I understand the
process of HTTP - the POST variables are just stored in the HTTP
headers in a platform-independant way so it shouldn't really matter.
I just don't seem to be able to display them in my page using Perl.

Probably a problem with my Perl code which I just copied
from an web tutorial!

Mark

"Sauli Karhu" <sa*********@nospam-saunalahti.fi> wrote in message
news:aA*****************@reader1.news.jippii.net.. .
Yes, it's possible. In the form tag of the PHP/HTML page on server1,
define the action value as URL to the second server, like this:

<form action="http://server2.com/process.cgi">

That's it...or did I misunderstand the question?

-Sauli Karhu

Mark wrote:
This may be a dumb question but can you tranfer variables stored in a PHP page on one server to a page on a different server via a form POST and be able to access those variables on the new page using Perl? From my
understanding of HTTP I can't see why this should be a problem but it does not seem to work at the moment although I am sure it is not a scripting
error at this stage

(Any newbie-level explanations welcomed!!)

Thanks
Mark




Jul 19 '05 #6

"Michael Austin" wrote
Mark wrote:
This may be a dumb question but can you tranfer variables stored in a PHP page on one server to a page on a different server via a form POST and be able to access those variables on the new page using Perl? From my
understanding of HTTP I can't see why this should be a problem but it does not seem to work at the moment although I am sure it is not a scripting
error at this stage

(Any newbie-level explanations welcomed!!)

Thanks
Mark

The answer to your question is "it depends".

Can you show us the relevant code snipettes and any error messages being
produced and a brief description of what you are trying to accomplish.

There is always more than one way to achieve the same outcome - and being a "newbie", you may have picked the most difficult solution :)

Michael Austin.
Consultant - Available.
Donations welcomed. Http://www.firstdbasource.com/donations.html
:)


I say "newbie" but I am more a newbie in Perl than PHP. While I am sure I
understand the process of POST data in HTTP headers (and my forms pass their
data quite happily between PHP pages) I suspect I am just not using Perl
correctly to display the variables. So long as I know that there is no
theoretical reason why it can't be done I will continue working on my Perl
code.

I may post a separate question about this in the Perl newsgroup as soem are
reading this thread in comp.lang.php.

Thanks
Mark.


Jul 19 '05 #7
Thanks. I suspect my Perl code so I will work on it as you suggest and post
to comp.lang.perl if I have any more problems. Thansk again.

Mark

"ZafT" <bu**@inhell.com> wrote in message
news:mL********************@comcast.com...
If you post some code, we can disect it a bit. I would start by getting a
simple version working. As someone already suggested, get the parsing in
perl down first. Then point your php page in the direction of the perl
script and you should be in business. I would make the first perl script
just parse and print out the variable just so you know it got there. Heck, you can even get the perl script to write more php code for you if you want. Fun stuff - maybe sloppy, but fun.

Shane
"Mark" <no*******@fakoaddresso.como> wrote in message
news:MJ*******************@fe2.news.blueyonder.co. uk...
This may be a dumb question but can you tranfer variables stored in a PHP page on one server to a page on a different server via a form POST and be able to access those variables on the new page using Perl? From my
understanding of HTTP I can't see why this should be a problem but it does not seem to work at the moment although I am sure it is not a scripting
error at this stage

(Any newbie-level explanations welcomed!!)

Thanks
Mark



Jul 19 '05 #8

"Joe Smith" wrote
Mark wrote:
This may be a dumb question but can you tranfer variables stored in a PHP page on one server to a page on a different server via a form POST and be able to access those variables on the new page using Perl?
1) The usual way of sending variable values from a PHP (or even a plain

HTML) page to the browser is by using a <FORM> tag and several <INPUT> tags.

2) The browser can respond to the ACTION= part of the <FORM> tag and
send modified, unmodified, or hidden values to the target server.

3) CGI programs written in any language can parse input from the POSTed
form and use the values.

Get the third step working first. Then it should be trivial to do
the first step.
-Joe


Thanks - will do. I suspect my Perl code so I will work on it as you suggest
and post to comp.lang.perl if I have any more problems.

Thanks.

Mark
Jul 19 '05 #9
>This may be a dumb question but can you tranfer variables stored in a PHP
page on one server to a page on a different server via a form POST and be
able to access those variables on the new page using Perl? From my
understanding of HTTP I can't see why this should be a problem but it does
not seem to work at the moment although I am sure it is not a scripting
error at this stage


Post your code so we can see if/where you're going wrong.

Regards,
Chris
Jul 19 '05 #10
Mark wrote:
you didn't misunderstand as that's pretty much how I understand the
process of HTTP - the POST variables are just stored in the HTTP
headers in a platform-independant way so it shouldn't really matter.
The POST variables are stored in the body of the POST, not the headers.
I just don't seem to be able to display them in my page using Perl.


1) Parse the POST body, using CGI.pm or other module that puts the
field names and values into a perl hash.
2) Create an HTML response using the data obtained from step 1.

I'd recommend writing a simple perl CGI that can handle this:
<form action="/cgi-bin/hello-world.cgi" method="POST">
<input type="text" name="yourname" value="Enter your name here">
<input type="hidden" name="private_variable" value="secret">
</form>

-Joe
Jul 19 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Mark | last post by:
This may be a dumb question but can you tranfer variables stored in a PHP page on one server to a page on a different server via a form POST and be able to access those variables on the new page...
3
by: Abby | last post by:
I have an application that is written in php/mysql on a Linux platform and need to transfer hosts. This is a session based application and I don't know a lot about php/Linux/mysql, but can get by....
5
by: Tony Archer | last post by:
Ok, first I know there are some db ways around this BUT I'll ask it anyhow: I have a couple ASP applications running on my server (non .NET) I would like to be able to get a sum total of how...
1
by: r_burgess | last post by:
I am looking for some guidance on transferring data between two pages in my ASP.net Web app (intranet). I have a form that will have a button and a text box on it (among other controls of course)...
0
by: Karl Rhodes | last post by:
Ok, we think we have a problem which SHOULD be simple to resolve but appears to be impossible (unless we're not as good as we thought we were!!!) We have seperate workstations on which we do our...
2
by: ryan.d.rembaum | last post by:
Hello, I am trying to build a standardized login screen that several different web application could use. What I would like is for the login screen to detect where the user has come from. ...
42
by: Dooglo | last post by:
I'm new VB and programming all together, but I'm getting he hang of it. My question is; I'm writting a program to figure square feet and yards when the user inputs "Length in feet and inch (...
15
by: http://www.visual-basic-data-mining.net/forum | last post by:
Does anyone have any idea how to transferring data from TextBox1 in form1 to textBox2 in form2..... That means after i fill in any data in textBox1 and click Next button... It will bring me to...
4
by: Marc E | last post by:
All, I'm coming from java and coldfusion, where one can set a "global" variable in one place (the servletcontext in java, Application.cfm in coldfusion) and all files in that site can then take...
2
by: garther | last post by:
Hi I'm trying to get something like this to work: Application calculates data and stores them in local SQL server. Once a week this data needs to copied to DVD. Then I need second application...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.