InternetReadString
- read a string from Internet resource

File Input/Output functions
(AmiBroker 6.20)


SYNTAX InternetReadString( handle )
RETURNS STRING
FUNCTION The function reads a string (line) from internet resource

NOTES:

  • If End-Of-File has been reached, the function returns empty string ("")
  • If End-of-File has NOT been reached, the function always returns non-empty string because each line read by this function ends with new line character " ", so if server has sent empty line it will be read as " "
  • You can trim new line characters using StrTrim

Internet* functions open wide area of applications including:

  1. querying web APIs for extra data
  2. using web/rest APIs for communication ( sending messages/alerts to Twitter, SMS gateways, etc)
EXAMPLE ih = InternetOpenURL( "https://www.quandl.com/api/v3/datasets/SEC/AAPL_SALESREVENUENET_Q.csv?api_key=" );
printf( "AAPL Revenue: " );
if( ih )
{
     while( ( str = InternetReadString( ih ) ) != "" )
     {
         printf( "%s", str );
     }
     InternetClose( ih );
}
SEE ALSO

References:

The InternetReadString function is used in the following formulas in AFL on-line library:

More information:

See updated/extended version on-line.