FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour For Mastitin : Load Txt from Url
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
For Mastitin : Load Txt from Url
Posted: Tue Dec 23, 2014 08:52 AM

Hi Manuel,
How I can make to load a csv file a file from a Url ( on xharbour)

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 1516
Joined: Thu May 27, 2010 02:06 PM
Re: For Mastitin : Load Txt from Url
Posted: Tue Dec 23, 2014 11:13 AM
Silvio ...

Code (fw): Select all Collapse
cDir:=  "http://ichart.yahoo.com/table.csv?s=GOOG"

     If lProxy
        cSection :="Config"
        cIniFile  := cFilePath(GetModuleFileName( GetInstance() ) ) + "finanza.ini"
        PROXY_SCHOOL    := GetIni(cIniFile, cSection, "Proxy")
        NPORT     := val(GetIni(cIniFile, cSection, "Port"))
        USERNAME := GetIni(cIniFile, cSection, "Username")
        PASSWORD := GetIni(cIniFile, cSection, "Password")
       Endif



  Try
      oHttp := CreateObject( "winhttp.winhttprequest.5.1" )

      if lProxy
         oHttp:SetProxy( HTTPREQUEST_PROXYSETTING_PROXY, PROXY_SCHOOL+":"+alltrim(str(NPORT)))

      endif

      oHttp:Open("GET", cDir, .f. )

       if lProxy
         oHttp:SetCredentials(USERNAME,PASSWORD,HTTPREQUEST_SETCREDENTIALS_FOR_PROXY)
      endif

      oHttp:Send()
       *cResp := oHttp:ResponseBody()

      cResp := oHttp:ResponseText()

      memowrit("finance.cvs",cResp )
 

  Catch
      MsgStop( "Error" )
      Return cResp
   End Try
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: For Mastitin : Load Txt from Url
Posted: Fri Dec 26, 2014 01:24 PM

thanks manuel

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com

Continue the discussion