MSXML2.XMLHTTP with proxy

MSXML2.XMLHTTP with proxy

Postby sambomb » Wed Jan 16, 2013 6:00 pm

Hi, I have this code already running:

Code: Select all  Expand view


   Try
      oConn := CreateObject( 'MSXML2.XMLHTTP' )
   Catch
      oConn := CreateObject( 'Microsoft.XMLHTTP' )
   End

   Try

      oConn:Open( 'POST', ::cUrl, FALSE )
      oConn:setRequestHeader( "Content-Type", "application/x-www-form-urlencoded" )

      oConn:Send( cParams )
      cRet := oConn:ResponseBody

      If !Empty( cRet )
         cRet := StrTran( StrTran( StrTran( cRet, "z{|}" ), Chr(13) ), Chr(10) )
      EndIf

      If File( cFile )
         FErase( cFile )
      EndIf

      hFile := FCreate( cFile, FC_NORMAL )
      FWrite( hFile, cRet )
      FClose( hFile )
      ::cBuffer:=cRet
      lRet := TRUE
     
   Catch
   
      lRet := FALSE

   End

Return lRet
 


But I want to define the proxy settings because this work in a normal network but inside a network with proxy I cant receive the return.

How to do it?

Obs.: I already try this

Code: Select all  Expand view

...
      oConn:Open( 'POST', ::cUrl, FALSE )
      oConn:setRequestHeader( "Content-Type", "application/x-www-form-urlencoded" )
      oConn:SetProxy( 2, cProxyIp+":"+cProxyPort )
      oConn:SetProxyCredentials( cProxyUser, cProxyPass )
      oConn:Send( cParams )
...
 
Email: SamirSSabreu@gmail.com
xHarbour 1.2.3 + Fwhh 20.2
User avatar
sambomb
 
Posts: 388
Joined: Mon Oct 13, 2008 11:26 am
Location: Itaocara - RJ - Brasil

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 95 guests