HTTP Post with URL parameters like GET?

I realize this is not a normal use-case, but is it legal?  We would like to take a GET request (with a fairly complex URL parameter list), change the method to a POST, and add *additional* data to the body via the POST data.  However, we want to keep the URL parameters constant to maintain compatibility with existing code.

So, summarizing, the POST URL might be something like:

POST: https://www.example.com/dispatch.php?param1=yes¶m2=no¶m3=maybe
DATA: param4=yes&param5=no....

TIA
mikecroweAsked:
Who is Participating?
 
Jason C. LevineConnect With a Mentor No oneCommented:
>> Can there be parameters in the URL and the POST headers?

Not sure about .NET (I don't use it) but with PHP, yes.

<form method="post" action="somescript.php?somevar=1&someothervar=2">
<input type="hidden" name="yetanothervar" value="3" />
</form

On somescript.php, the following would be available for handling:

$_GET['somevar']
$_GET['someothervar']
$_POST['yetanothervar']

So long as the query string is present, both the $_GET and $_POST arrays can contain values.
0
 
Jason C. LevineNo oneCommented:
Hi mikecrowe,

I'm not sure I understand what you want.  Can you explain better and also indicate which language will process the request?

For example, PHP allows variables to exist in both the query string and the post array...
0
 
mikecroweAuthor Commented:
At this point, we haven't chosen the application language, but are leaning towards .NET.  PHP is also an option.

Basically, I think you understand.  Can there be parameters in the URL and the POST headers?
0
 
mikecroweAuthor Commented:
Perfect, jason1178.  Many thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.