Link to home
Start Free TrialLog in
Avatar of rascal
rascalFlag for United States of America

asked on

How to programmatically send a form in PHP (ASP equivalent shown below)

We are able to programmatically send a form to a target website (in this case, a contact information form sent to Constant Contact) using the following ASP code:

      ' allocate the XMLHTTP object that will be used to send the form
      set xmlServerHttp = server.createObject("MSXML2.ServerXMLHTTP.4.0")
      xmlServerHttp.Open "POST", sSourceURL, False
      xmlServerHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
      
      'response.write("sParams=" & sParams & "<br>")
      
      ' send the form
      xmlServerHttp.send sParams
      
      ' set the return value
      SendFormToIContactMovement = trim(xmlServerHttp.responsetext)
      Set xmlServerHttp = Nothing

But a client has a need for the same functionality on a PHP site. Is there a way to replicate this using PHP code?

thanks experts!
ASKER CERTIFIED SOLUTION
Avatar of shanikawm
shanikawm
Flag of Sri Lanka image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of paulnwgb
paulnwgb

Damn.. I was first responder when I started typing.

Maybe I should just hit Google in the future rather than actually writing a solution.

;)
SOLUTION
Avatar of Robin Hickmott
Robin Hickmott

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rascal

ASKER

thanks all - shanikawm's answer was the most complete and included examples, but everyone was very helpful - and the responses were almost immediate!

thanks again to all!