esistono "mille cose" per integrare twitter nelle nostre pagine ma in buona sostanza quello che cambia è il vestito.
Volendo fare un modulo per visualizzare il nostro profilo e contenuto twitter basta in realtà una funzione:
$nostro_profilo=json_decode(file_get_contents($url),TRUE);
$url è quello alle api di twitter:
$url = 'http://api.twitter.com/1/statuses/user_timeline.json?screen_name='.$username.'&count='.$count;
$username il vostro username twitter e count il numero di tweets da mostrare.
invece di file_get_contents() potete usare una richiesta ajax o una richiesta Curl, non cambia nulla.
usando json_decode, il contenuto di ritorno sarà un array che non si limita al solo testo del o dei tweets ma vi permetterà praticamente di "embeddare" il vostro intero profilo:
Array
(
[0] => Array
(
[created_at] => Fri Dec 09 12:59:56 +0000 2011
[id] =>
[id_str] =>
[text] =>
[source] =>
[truncated] =>
[in_reply_to_status_id] =>
[in_reply_to_status_id_str] =>
[in_reply_to_user_id] =>
[in_reply_to_user_id_str] =>
[in_reply_to_screen_name] =>
[user] => Array
(
[id] =>
[id_str] =>
[name] => Spazioalchimia
[screen_name] => Spazioalchimia
[location] =>
[url] => http://www.spazioalchimia.it
[description] =>
[protected] =>
[followers_count] => 2
[friends_count] => 14
[listed_count] => 0
[created_at] => Fri Jun 10 12:32:42 +0000 2011
[favourites_count] => 0
[utc_offset] => 3600
[time_zone] => Rome
[geo_enabled] => 1
[verified] =>
[statuses_count] => 9
[lang] => it
[contributors_enabled] =>
[is_translator] =>
[profile_background_color] => C0DEED
[profile_background_image_url] => http://a0.twimg.com/images/themes/theme1/cc.png
[profile_background_image_url_https] => https://si0.twimg.com/images/themes/theme1/cc.png
[profile_background_tile] =>
[profile_image_url] => http://a0.twimg.com/profile_images/1670032417/ccc.png
[profile_image_url_https] => https://si0.twimg.com/profile_images/1670032417/ccl.png
[profile_link_color] => 0084B4
[profile_sidebar_border_color] => C0DEED
[profile_sidebar_fill_color] => DDEEF6
[profile_text_color] => 333333
[profile_use_background_image] => 1
[default_profile] => 1
[default_profile_image] =>
[following] =>
[follow_request_sent] =>
[notifications] =>
)
[geo] =>
[coordinates] =>
[place] =>
[contributors] =>
[retweet_count] => 0
[favorite_count] => 0
[favorited] =>
[retweeted] =>
[lang] => it
)
)
non c'è da spiegare molto, le key degli array sono abbastanza "parlanti"