XMLHTTP IN PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
phpwalker
Forum Commoner
Posts: 81
Joined: Sun Apr 23, 2006 12:18 pm

XMLHTTP IN PHP

Post 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!
dey.souvik007
Forum Newbie
Posts: 3
Joined: Fri Jul 25, 2008 4:25 am

Re: XMLHTTP IN PHP

Post 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!
phpwalker
Forum Commoner
Posts: 81
Joined: Sun Apr 23, 2006 12:18 pm

Re: XMLHTTP IN PHP

Post by phpwalker »

*bump*
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: XMLHTTP IN PHP

Post 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.
phpwalker
Forum Commoner
Posts: 81
Joined: Sun Apr 23, 2006 12:18 pm

Re: XMLHTTP IN PHP

Post by phpwalker »

thnks onion2k. i've found the api to do the similar task already. ^^
Post Reply