RE: [PHP] Passing values from ASP to PHP
I'm no ASP guru (never touched it actually), but...it seems as if this will add an extra "&" on the end of the url. myscript.php?one=blue&two=red&three=yellow& ^ -Original Message- From: Opec Kemp [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 01, 2001 9:47 AM To: [EMAIL PROTECTED] Cc: PHP General List Subject: RE: [PHP] Passing values from ASP to PHP Hi, To enumerate the key/value in ASP from the form you'd do this <% dim element dim objForm dim strURL '/* We're creating an object so that it won't matter which ' * HTTP method the previous form uses. ' */ If LCase(Server.Request("HTTP_METHOD")) = "post" Then Set objForm = Request.Form Else Set objForm = Request.QueryString End If strURL = "myscript.php?" '/* Now step through the form For each element in objForm '/* Key Name is in the "element" var ' * Value of the key is in the objForm(element) ' * Now build the Redirect string ' */ strURL = strURL & Server.URLEncode(element) & "="& Server.URLEncode(objForm(element)) & "&" Next '/* Now redirect Response.Redirect(strURL) %> That should do it. > > I've been given a project that I want to use PHP with, but > > unfortunately there are unchangable hard-coded values that point clients to an ASP > > script residing on our server. Here's what I want to do, and I don't > > really know how to do it: > > > > I want to pass all the key/value pairs that are passed to the > > ASP script > > to a PHP script. I can get values with Request.Form("key_name"), but > > that takes hard-coding the name of the key. > > > > So if the following is passed to the ASP script: > > one=blue&two=red&three=yellow > > > > Then I would want to redirect to > > myscript.php?one=blue&two=red&three=yellow > > > > How do I go about walking through all the key/values that > > have been passed > > in ASP? I really don't want to have to learn this ugly language.. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Passing values from ASP to PHP
Hi, To enumerate the key/value in ASP from the form you'd do this <% dim element dim objForm dim strURL '/* We're creating an object so that it won't matter which ' * HTTP method the previous form uses. ' */ If LCase(Server.Request("HTTP_METHOD")) = "post" Then Set objForm = Request.Form Else Set objForm = Request.QueryString End If strURL = "myscript.php?" '/* Now step through the form For each element in objForm '/* Key Name is in the "element" var ' * Value of the key is in the objForm(element) ' * Now build the Redirect string ' */ strURL = strURL & Server.URLEncode(element) & "="& Server.URLEncode(objForm(element)) & "&" Next '/* Now redirect Response.Redirect(strURL) %> That should do it. > > I've been given a project that I want to use PHP with, but > > unfortunately there are unchangable hard-coded values that point clients to an ASP > > script residing on our server. Here's what I want to do, and I don't > > really know how to do it: > > > > I want to pass all the key/value pairs that are passed to the > > ASP script > > to a PHP script. I can get values with Request.Form("key_name"), but > > that takes hard-coding the name of the key. > > > > So if the following is passed to the ASP script: > > one=blue&two=red&three=yellow > > > > Then I would want to redirect to > > myscript.php?one=blue&two=red&three=yellow > > > > How do I go about walking through all the key/values that > > have been passed > > in ASP? I really don't want to have to learn this ugly language.. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Passing values from ASP to PHP
Well, if it's a query string it's easy... In the ASP page you do: <% Response.Redirect("myscript.php?" & Request.ServerVariables("QUERY_STRING")) %> If it's posted form data do this: <% Dim Querystring Querystring = "" For each Item in Request.Form if Querystring = "" Then Querystring = Item & "=" & Server.UrlEncode(Request.Form(Item)) Else Querystring = Querystring & "&" & Item & "=" & Server.UrlEncode(Request.Form(Item)) ' the above line isn't supposed to wrap End If Next Response.Redirect("myscript.php?" & Querystring) %> On 2/28/01 4:08 PM this was written: > I've been given a project that I want to use PHP with, but unfortunately > there are unchangable hard-coded values that point clients to an ASP > script residing on our server. Here's what I want to do, and I don't > really know how to do it: > > I want to pass all the key/value pairs that are passed to the ASP script > to a PHP script. I can get values with Request.Form("key_name"), but > that takes hard-coding the name of the key. > > So if the following is passed to the ASP script: > one=blue&two=red&three=yellow > > Then I would want to redirect to > myscript.php?one=blue&two=red&three=yellow > > How do I go about walking through all the key/values that have been passed > in ASP? I really don't want to have to learn this ugly language.. -- Thomas Deliduka IT Manager - New Eve Media The Solution To Your Internet Angst http://www.neweve.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]