TIP and TipClientHttp() class

TIP and TipClientHttp() class

Postby JC » Sat Nov 01, 2008 5:12 pm

Antonio and friends,


How I can obtain a manual for TIP class? I need to use tipClientHttp() and your method ::open()... but this not works.

Please, someone can help me?
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Postby Horizon » Sat Nov 01, 2008 5:36 pm

Hi JC,

I have not tested yet. It is given from someone of this forum. It may help you.

Code: Select all  Expand view

IF wfReadURL("http://www.test.be/test.txt") # "Error opening"
   ... File is there
ELSE
   ... File is not there
ENDIF

FUNCTION wfReadURL(cUrl)
  LOCAL cPageContent:="Error: " + cUrl + " not found or timed out."
  LOCAL oConn
 
  IF Upper(Left(cUrl,4))#"HTTP"
     cUrl:="http://"+cUrl
  ENDIF
 
  TRY
 
   oConn := TipClientHttp():New(TURL():New(cUrl))
   oConn:nConnTimeout := 20000

   IF oConn:Open(cURL)
      cPageContent := oConn:ReadAll()
      oConn:Close()
   ENDIF
   
  CATCH
   cPageContent:="Error opening " + cUrl
   
  END
 
RETURN cPageContent

//================================================================================
FUNCTION wfSaveURL(cUrl,cSaveAs)

  LOCAL cPageContent:=wfReadURL(cUrl)
  LOCAL lReturn:=.T.
 
  IF cPageContent="Error:"
     lReturn:=.F.
  ELSE
     MemoWrite(cSaveAs,cPageContent)
     IF !File(cSaveAs)
        lReturn:=.T.
     ENDIF   
  ENDIF
 
RETURN lReturn

Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Postby JC » Sat Nov 01, 2008 5:45 pm

Hakan,

I use transparent proxy for my connection... is necessary to define the server and port of my proxy to tip class?

If yes, how I can do?
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil


Return to FiveWin for Harbour/xHarbour

Who is online

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