FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour MSXML2.XMLHTTP with proxy
Posts: 389
Joined: Mon Oct 13, 2008 11:26 AM
MSXML2.XMLHTTP with proxy
Posted: Wed Jan 16, 2013 06:00 PM
Hi, I have this code already running:

Code (fw): Select all Collapse
   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 (fw): Select all Collapse
...
      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

Continue the discussion