Twitter para FWH
Posted: Tue Feb 12, 2013 12:46 pm
Estos son los primeros pasos hacia la construcción de una Clase Twitter para FWH basada en Curl
Nos basamos en este ejemplo:
http://www.barattalo.it/2010/09/09/how-to-change-twitter-status-with-php-and-curl-without-oauth/
y usamos la libreria curl para Harbour disponible desde aqui:
http://code.google.com/p/harbour-and-xharbour-builds/downloads/detail?name=hbcurl.zip&can=2&q=
Primera prueba:
Necesitamos localizar el valor del define CURLOPT_RETURNTRANSFER. No esta disponible dentro de hbcurl.ch de Harbour
Nos basamos en este ejemplo:
http://www.barattalo.it/2010/09/09/how-to-change-twitter-status-with-php-and-curl-without-oauth/
y usamos la libreria curl para Harbour disponible desde aqui:
http://code.google.com/p/harbour-and-xharbour-builds/downloads/detail?name=hbcurl.zip&can=2&q=
Primera prueba:
- Code: Select all Expand view
- #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
Necesitamos localizar el valor del define CURLOPT_RETURNTRANSFER. No esta disponible dentro de hbcurl.ch de Harbour