Retrieve Website Data

Post Reply
User avatar
cdmmaui
Posts: 653
Joined: Fri Oct 28, 2005 9:53 am
Location: The Woodlands - Dallas - Scottsdale - London
Contact:

Retrieve Website Data

Post by cdmmaui »

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
AntoninoP
Posts: 347
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy
Contact:

Re: Retrieve Website Data

Post by AntoninoP »

Here some code from examples of harbour:

Code: Select all

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,
Last edited by AntoninoP on Wed Aug 05, 2015 8:46 am, edited 1 time in total.
User avatar
bpd2000
Posts: 153
Joined: Tue Aug 05, 2014 9:48 am
Location: India

Re: Retrieve Website Data

Post by bpd2000 »

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.!
AntoninoP
Posts: 347
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy
Contact:

Re: Retrieve Website Data

Post by AntoninoP »

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,
Post Reply