[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

HTTP Post with URL parameters like GET?

Posted on 2008-11-18
4
Medium Priority
?
1,519 Views
Last Modified: 2013-11-19
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
0
Comment
Question by:mikecrowe
  • 2
  • 2
4 Comments
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 22989982
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
 

Author Comment

by:mikecrowe
ID: 22990380
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
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 200 total points
ID: 22990409
>> 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
 

Author Closing Comment

by:mikecrowe
ID: 31518027
Perfect, jason1178.  Many thanks.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses
Course of the Month19 days, 3 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question