ciao, c'e' un progetto che sta facendo leggere l'ulisse di james joyce su twitter
twitter e' una piattaforma un po' inutile e un po' 2.0 per comunicare (ad amici o sconosciuti) cosa stai facendo, in stile sms (max 140 caratteri alla volta), via web o icq o telefono etc
alcuni la stanno usando per sbatterci dentro dei mini-feed rss (cnn, etc) non e' detto che la cosa abbia molto senso ;-)
cmq, in sto progetto di letteratura e nuovi media, booktwo, un tizio ha codato uno scriptino in php per fargli leggere un file di testo e mandarne un pezzetto alla volta su twitter (tipo ogni due minuti)
http://www.booktwo.org/ http://www.booktwo.org/swotter/ http://www.twitter.com http://twitter.com/booktwo
lo scipt e' semplice, e lo copincollo qui sotto. a me e' venuta una mezz'idea (tre quarti d'idea) di usarlo per buttare su twitter un libro in italiano (pensavo a Q di luther blisset, che si scarica anche come .txt, ed e' un bel libro)
lo script usa libcurl sembra semplice
qualcuno lo guarda e mi dice cosa ne pensa? ciao carloz
-----------
<?php /*
Swotter by James Bridle
A Twitter Reader
www.booktwo.org/swotter/
*/
$uname = 'USERNAME'; // enter your twitter username or email address $pwd = 'PASSWORD'; // enter your password $text = file('/home/user/path/filename.txt'); // enter the FULL PATH to the the file you want to read
/* Make sure you've got a file in the same directory called counter.txt, containing just the number 0, as well as the named text file. Adjust the three paths given below. Ensure that counter.txt is read AND writable. Ensure that the reading file is readable. */
$fr = fopen('/home/user/path/counter.txt', 'r'); if(!$fr) { $linenum = 0; // first line $fr = fopen('/home/user/path/counter.txt','w'); if(!$fr) { echo "Could not create the counter file!"; exit; } fputs($fr, $linenum); fclose($fr); } else { $linenum = fgets($fr); echo "Line: $linenum <br />"; // print line number
$status = $text[$linenum]; // put the numbered line into status
echo $status; // print line in case you're watching
// Do Twitter stuff... $twitter_url = 'http://twitter.com/statuses/update.xml'; $curl_handle = curl_init(); curl_setopt($curl_handle,CURLOPT_URL,"$twitter_url"); curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2); curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1); curl_setopt($curl_handle,CURLOPT_POST,1); curl_setopt($curl_handle,CURLOPT_POSTFIELDS,"status=$status"); curl_setopt($curl_handle,CURLOPT_USERPWD,"$uname:$pwd"); $buffer = curl_exec($curl_handle); curl_close($curl_handle); // End Twitter stuff...
// print success or not in case you're watching if (empty($buffer)){echo '<br/>message';}else{echo '<br/>Sent successfully';}
fclose($fr); $fr = fopen('/home/user/path/counter.txt','w'); if(!$fr) { echo "Could not re-create the counter file!"; exit; }
$linenum++; // update counter fputs($fr, $linenum); // update line number fclose($fr); // finish by closing counter file }
?>