Twitter from FWH apps
Posted: Tue Feb 12, 2013 12:43 pm
These are the first steps towards a Class Twitter for FWH based on Curl 
Based on this example:
http://www.barattalo.it/2010/09/09/how-to-change-twitter-status-with-php-and-curl-without-oauth/
and using the curl library for Harbour, available from here:
http://code.google.com/p/harbour-and-xharbour-builds/downloads/detail?name=hbcurl.zip&can=2&q=
This is the first test:
We need to find the value for CURLOPT_RETURNTRANSFER. It is not available in Harbour's hbcurl.ch

Based on this example:
http://www.barattalo.it/2010/09/09/how-to-change-twitter-status-with-php-and-curl-without-oauth/
and using the curl library for Harbour, available from here:
http://code.google.com/p/harbour-and-xharbour-builds/downloads/detail?name=hbcurl.zip&can=2&q=
This is the first test:
Code: Select all | Expand
#include "FiveWin.ch"
#include "hbcurl.ch"
function Main()
local hCurl, cPage := Space( 200 )
curl_global_init()
if ! Empty( hCurl := curl_easy_init() )
curl_easy_setopt( hCurl, HB_CURLOPT_URL, "https://mobile.twitter.com/session/new" )
curl_easy_setopt( hCurl, HB_CURLOPT_SSL_VERIFYPEER, .F. )
curl_easy_setopt( hCurl, HB_CURLOPT_FAILONERROR, 1 )
curl_easy_setopt( hCurl, HB_CURLOPT_FOLLOWLOCATION, 1 )
// curl_easy_setopt( hCurl, HB_CURLOPT_RETURNTRANSFER, 1 )
curl_easy_setopt( hCurl, HB_CURLOPT_TIMEOUT, 5 )
curl_easy_setopt( hCurl, HB_CURLOPT_COOKIEJAR, "my_cookies.txt" )
curl_easy_setopt( hCurl, HB_CURLOPT_COOKIEFILE, "my_cookies.txt" )
curl_easy_setopt( hCurl, HB_CURLOPT_USERAGENT, "Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3 " )
curl_easy_setopt( hCurl, HB_CURLOPT_ERRORBUFFER, @cPage )
MsgInfo( curl_easy_perform( hCurl ) )
MsgInfo( curl_easy_dl_buff_get( hCurl ) )
curl_easy_reset( hCurl )
endif
curl_global_cleanup()
return nil
We need to find the value for CURLOPT_RETURNTRANSFER. It is not available in Harbour's hbcurl.ch