siric Posted April 11, 2006 Share Posted April 11, 2006 Hi,I have a short script that I need to convert from ASP to PHP. It basically pushs headers and variables through a URL from a form. [code]' Assign values to variablesstrURL = "http://192.168.254.1:7000/"varRecipient = Request("frmPhone") & ":1:1"varSubject = Request("frmSubject")varMessage = Request("frmMessage")varContentLength = Len(varSubject) + Len(varMessage)Set oXmlHttp = Server.Createobject("Msxml2.ServerXMLHTTP")oXmlHttp.open "POST", strURL, FalseCall oXmlHttp.setRequestHeader("Host","Host")Call oXmlHttp.setRequestHeader("X-Service","service")Call oXmlHttp.setRequestHeader("X-Password","password")Call oXmlHttp.setRequestHeader("X-Sender","sender")Call oXmlHttp.setRequestHeader("X-Recipient",varRecipient)Call oXmlHttp.setRequestHeader("Content-Length",varContentLength)oXmlHttp.send(varSubject & varMessage)If (oXmlHttp.status <> 200) Then ' If not successful display error response text and code strReturn = oXmlHttp.responseText Response.Write(strReturn & "<br>") Response.Write(oXmlHttp.status & "<br>") Response.Write(oXmlHttp.readyState & "<br><br>") Response.Write("Error!! <br><br>")Else ' Else display sms sent Response.Write("<b>All Ok!</b> <br><br> Recipient(s): " & Request("frmPhone") & "<br> Subject: " & varSubject & "<br> Message: " & varMessage & "<br><br>")End If[/code]So I am trying find the equivalent of Server.Createobject,oXmlHttp.setRequestHeader,oXmlHttp.send,Response.WriteIt is possible? My research is pointing me in the direction of AJAX. Is that the only option?ThanksSteve Link to comment https://forums.phpfreaks.com/topic/7110-converting-asp-to-php/ Share on other sites More sharing options...
trq Posted April 11, 2006 Share Posted April 11, 2006 Firtly, the Msxml2.ServerXMLHTTP object is not a native asp object, but an extension. It looks like most of this functionality would be available in php's [a href=\"http://php.net/curl\" target=\"_blank\"]curl[/a] extension though.Server.Createobject = curl_init()oXmlHttp.setRequestHeader = curl_setopt()oXmlHttp.send = curl_exec()Response.Write = echo() Link to comment https://forums.phpfreaks.com/topic/7110-converting-asp-to-php/#findComment-25859 Share on other sites More sharing options...
siric Posted April 11, 2006 Author Share Posted April 11, 2006 [!--quoteo(post=363665:date=Apr 11 2006, 02:20 PM:name=thorpe)--][div class=\'quotetop\']QUOTE(thorpe @ Apr 11 2006, 02:20 PM) [snapback]363665[/snapback][/div][div class=\'quotemain\'][!--quotec--]Firtly, the Msxml2.ServerXMLHTTP object is not a native asp object, but an extension. It looks like most of this functionality would be available in php's [a href=\"http://php.net/curl\" target=\"_blank\"]curl[/a] extension though.Server.Createobject = curl_init()oXmlHttp.setRequestHeader = curl_setopt()oXmlHttp.send = curl_exec()Response.Write = echo()[/quote]Thanks for the info. Link to comment https://forums.phpfreaks.com/topic/7110-converting-asp-to-php/#findComment-25949 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.