473,507 Members | 2,451 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

POST Params - getting unknown

Hi,

Can anyone tell me if it is possible to generate the actual URL of the
current PHP script (with all POST data included)?

I have a third-party application that I'd like to use to see HTTP
requests to my server. For the most part, it works, but I believe some
of the variables are named incorrectly.

In a nutshell, the application transmits to
http://myserver.com?this=that&that=theOther, where my script grabs the
post data. I want to modify my script to save the actual POST url into
the database so I can see all of the POST parameter names.

Thanks in advance,
- Best regards,
Lee
Jul 17 '05 #1
4 4994
"Leester" <lr*****@lanl.gov> wrote in message
news:54**************************@posting.google.c om...

Can anyone tell me if it is possible to generate the actual URL of the
current PHP script (with all POST data included)?

I have a third-party application that I'd like to use to see HTTP
requests to my server. For the most part, it works, but I believe some
of the variables are named incorrectly.

In a nutshell, the application transmits to
http://myserver.com?this=that&that=theOther, where my script grabs the
post data. I want to modify my script to save the actual POST url into
the database so I can see all of the POST parameter names.


You *say* 'POST', but you seem to be describing 'GET.'

If I have not misunderstood, something like the following, concatenated
together, should capture what you want:
'http://'
$_SERVER['HTTP_HOST'] or $_SERVER['SERVER_NAME']
$_SERVER['PHP_SELF'] . $_SERVER['QUERY_STRING']

You can also look at:
basename(dirname(__FILE__))
basename(__FILE__)
Jul 17 '05 #2

"<>" <lo******@44.255.255.255> wrote in message
news:A7*****************@twister.socal.rr.com...
"Leester" <lr*****@lanl.gov> wrote in message
news:54**************************@posting.google.c om...

Can anyone tell me if it is possible to generate the actual URL of the
current PHP script (with all POST data included)?

I have a third-party application that I'd like to use to see HTTP
requests to my server. For the most part, it works, but I believe some
of the variables are named incorrectly.

In a nutshell, the application transmits to
http://myserver.com?this=that&that=theOther, where my script grabs the
post data. I want to modify my script to save the actual POST url into
the database so I can see all of the POST parameter names.


You *say* 'POST', but you seem to be describing 'GET.'

If I have not misunderstood, something like the following, concatenated
together, should capture what you want:
'http://'
$_SERVER['HTTP_HOST'] or $_SERVER['SERVER_NAME']
$_SERVER['PHP_SELF'] . $_SERVER['QUERY_STRING']

You can also look at:
basename(dirname(__FILE__))
basename(__FILE__)


if it is GET and not POST, try looking at these variables:

$_SERVER['HTTPS']
$_SERVER['HTTP_HOST']
$_SERVER['SERVER_PORT']
$_SERVER['REQUEST_URI']

something like this should work ok:

<?php

$url = "http";
if(isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] != 'off')) {
$url .= "s";
}
$url .= "://";
$url .= $_SERVER['HTTP_HOST'];
if($_SERVER['SERVER_PORT'] != "80") {
$url .= ":" . $_SERVER['SERVER_PORT'];
}
$url .= $_SERVER['REQUEST_URI'];

?>
Leslie
Jul 17 '05 #3
Leester wrote:
Hi,

Can anyone tell me if it is possible to generate the actual URL of the
current PHP script (with all POST data included)?


POST data is not sent in the URL, it is sent as part of the HTTP request
block. GET data is sent in the URL in the form

http://www.mine.net/page.php?var1=value1&var2=value2

GET should NOT be used for pages that update a database, because then it
is possible for users to unknowingly bookmark that URL, and everytime
that bookmark is clicked, the database will be updated with the same
data that it received the first time.

You could try this on the target page (the script mentioned in action=''
in the <form ...> statement):

foreach($_POST as $varname => $value)
{
echo "<p>\$_POST[$varname] points to $value</p>";
}

I've never tried foreach on $_POST, but it should work.
--
Bob
London, UK
echo Mail fefsensmrrjyaheeoceoq\! | tr "jefroq\!" "@obe.uk"
Jul 17 '05 #4
lr*****@lanl.gov (Leester) wrote in message news:<54**************************@posting.google. com>...
In a nutshell, the application transmits to
http://myserver.com?this=that&that=theOther, where my script grabs the
post data. I want to modify my script to save the actual POST url into
the database so I can see all of the POST parameter names.


If I understand you right....

<?php
$post_vars = '';
if ($_POST)
{
foreach($_POST as $key=>$value)
{
$value = urlencode(stripslashes($value));
$post_vars .= "&$key=$value";
}
$post_vars = substr($post_vars, 1); //remove the first "&" from the
string
}
echo 'POST variables in string: '. $post_vars;
?>

--
"Silence is the only right answer for many wrong questions" --
G.K.Moopanar, Politician
Email: rrjanbiah-at-Y!com
Jul 17 '05 #5

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

Similar topics

0
5340
by: Ing. Angel León | last post by:
http://wedoit4you.com/forums4you/display_message.php?Msg_pk_id=628 /** Author: Ing. Angel Leon Function: postHttps($url,$params) Given the full URL of the Target and The Params it will...
5
23980
by: franck | last post by:
HI, this is my code params = {} params = '*****'; params = '***'; params = '**********'; params = '******'; params = '****';
2
1526
by: Raaijmakers, Vincent (GE Infrastructure) | last post by:
Please tell me if this is true or not.. In a all my applications I used the old fashioned way of "POST" requests: params = urllib.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0}) headers =...
12
2633
by: Assaf | last post by:
Hi all, My client is using an online service provider that processes survey responses. After a user fills survey.aspx and presses the OK button, 2 things need to happen: 1. the data has to...
4
2853
by: Piotr Strycharz | last post by:
Hi all I do have a problem. How can I transfer user to another server using POST. The problem is that Server.Transfer (preserves form data) works just in current server. Response.Redirect -...
11
4791
by: livin | last post by:
I need to post form data to an ASP page that looks like this on the page itself... <form method='POST'><input src=\icons\devices\coffee-on.gif type='image' align='absmiddle' width=16 height=16...
1
1958
by: empiresolutions | last post by:
im using the script.aculo.us drag n drop script. i am having an issue getting a checkbox to POST its value if checked, once the row the checkbox is in is moved. I believe that once i change the...
2
2542
by: FFMG | last post by:
Hi, I was looking at http://www.php.net/manual/en/function.call-user-func-array.php and I was wondering... Given, // -- function foo( &$params) {
4
3799
SuperMetroid
by: SuperMetroid | last post by:
The html code of the form, and my code are below. I can't get the value to post/submit.. instead I get an error. Can anyone help? HTML Code of Form: <form method='post' autocomplete='off'> ...
0
7223
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
7110
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...
1
7030
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...
1
5041
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
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...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1540
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.