Page 1 of 1

XMLHTTP IN PHP

Posted: Fri Jul 25, 2008 3:53 am
by phpwalker

Code: Select all

 
Function ASP_FUNCTION(sUserName)
       Dim DataToSend, xmlhttp, sReturnValue
 
    DataToSend = sUserName
 
    set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP.6.0")
 
    xmlhttp.Open "POST","http://SOMEHOST.COM/ABC.JSP",false
    xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    xmlhttp.send DataToSend
    sReturnValue = xmlhttp.responseText
    Set xmlhttp = nothing
    wm_setRestrictIP = sReturnValue
End Function
 
 
Hi all, the above code is ASP function, is it possible to make it runnable in PHP? How? I've googled it, just that all is JScript with PHP, is it possible to make a function in PHP, too?

Thanks in advance!

Re: XMLHTTP IN PHP

Posted: Fri Jul 25, 2008 5:43 am
by dey.souvik007
phpwalker wrote:

Code: Select all

 
Function ASP_FUNCTION(sUserName)
       Dim DataToSend, xmlhttp, sReturnValue
 
    DataToSend = sUserName
 
    set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP.6.0")
 
    xmlhttp.Open "POST","http://SOMEHOST.COM/ABC.JSP",false
    xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    xmlhttp.send DataToSend
    sReturnValue = xmlhttp.responseText
    Set xmlhttp = nothing
    wm_setRestrictIP = sReturnValue
End Function
 
 
Hi all, the above code is ASP function, is it possible to make it runnable in PHP? How? I've googled it, just that all is JScript with PHP, is it possible to make a function in PHP, too?

Thanks in advance!

Re: XMLHTTP IN PHP

Posted: Mon Jul 28, 2008 3:21 am
by phpwalker
*bump*

Re: XMLHTTP IN PHP

Posted: Mon Jul 28, 2008 3:55 am
by onion2k
No, you can't make that code run in PHP.

You could write some PHP code that does exactly the same thing though. All that code does is fetch "http://SOMEHOST.COM/ABC.JSP" with sUserName as a POST variable and the content header set to "application/x-www-form-urlencoded". It'd be pretty easy in PHP if you use CURL.

Re: XMLHTTP IN PHP

Posted: Fri Aug 01, 2008 3:07 am
by phpwalker
thnks onion2k. i've found the api to do the similar task already. ^^