FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Retrieve Website Data
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Retrieve Website Data
Posted: Tue Aug 04, 2015 09:05 PM

Hello Everyone,

Has anyone used FWH to create an application to "scrape" (retrieve) data from a website by providing a string parameter? If so, could you provide sample code?

Thank you,

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 375
Joined: Tue Feb 10, 2015 09:48 AM
Re: Retrieve Website Data
Posted: Wed Aug 05, 2015 08:03 AM
Here some code from examples of harbour:
Code (fw): Select all Collapse
proc main()
   local socket, buffer
   socket := hb_inetCreate()
   socket := hb_inetConnect( "www.fortify.net", 80, socket )
   ? "INETCONN", socket
   ? "INETTIMEOUT", hb_inetTimeout( socket, 500 )
   ? "INETERR", hb_inetErrorCode( socket )
   ? "INETFD", hb_inetFD( socket )
   ? "INETSEND", hb_inetSend( socket, "GET / http/1.1" + hb_inetCRLF() + "Host: " + "www.syenar.hu" + hb_inetCRLF() + hb_inetCRLF() )
   ? "INETERR", hb_inetErrorCode( socket )
   buffer := Space( 1024 )
   ? "INETRECVALL", hb_inetRecvAll( socket, @buffer, Len( buffer ) )
   ? "BUFFER", ">" + AllTrim( buffer ) + "<"
   ? "INETCLOSE", hb_inetClose( socket )
return


Hope this help,
Posts: 153
Joined: Tue Aug 05, 2014 09:48 AM
Re: Retrieve Website Data
Posted: Wed Aug 05, 2015 08:15 AM

Thank you Mr. AntoninoP
For https sam code will work or any other method

Regards, Greetings



Try FWH. You will enjoy it's simplicity and power.!
Posts: 375
Joined: Tue Feb 10, 2015 09:48 AM
Re: Retrieve Website Data
Posted: Wed Aug 05, 2015 08:25 AM
The code is taken from harbour\contrib\hbssl\tests\test.prg, the same example show how to use ssl for a secure connection.
But I don't tried it, it is necessary download OpenSSL and build hbssl.
Regards,

Continue the discussion