| 台灣最大防水抓漏接案平台 輕鬆接案網 | 24H全省服務.合約保障 提供您平價又專業的搬家服務 |
[php] PO3 一次幫你把訊息PO到3個地方(Buboo,Plurk |
| 房東:jeff 發表時間:2012-07-18 | [檢舉] |
|
到處看得到 web 2.0 的應用,另稱微網誌的類twitter線上服務更是多如繁星(誤)。 其實很多人應該都會在不同的服務申請帳號,只是要發一則訊息卻要登入各個服務的網頁實在麻煩。
其實,從技術的角度來看buboo,plurk,twitter三者還滿相似的,只是plurk目前並沒有公開它的API。
注意:PHP必須能夠使用 curl 功\能,buboo和twitter都會用到。 twitter 發文函式: 01.// 發文到twitter 02.function post_twitter($uid, $pwd, $msg) { 03. $curl_handle = curl_init(); 04. curl_setopt($curl_handle, CURLOPT_URL, \'http://twitter.com/statuses/update.xml\'); 05. curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2); 06. curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); 07. curl_setopt($curl_handle, CURLOPT_POST, 1); 08. curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "status=$msg"); 09. curl_setopt($curl_handle, CURLOPT_USERPWD, "$uid:$pwd"); 10. $buffer = curl_exec($curl_handle); 11. curl_close($curl_handle); 12. // 檢查結果 13. return chkresult($buffer,\'<text>\'); 14.}buboo 發文函式: 01.// 發文到buboo 02.function post_bubbo($uid, $pwd, $msg) { 03. $curl_handle = curl_init(); 04. curl_setopt($curl_handle, CURLOPT_URL, \'http://api.buboo.tw/update.xml\'); //改 05. curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2); 06. curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); 07. curl_setopt($curl_handle, CURLOPT_POST, 1); 08. curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "message=$msg"); //改 09. curl_setopt($curl_handle, CURLOPT_USERPWD, "$uid:$pwd"); 10. $buffer = curl_exec($curl_handle); 11. curl_close($curl_handle); 12. // 檢查結果 13. return chkresult($buffer,\'<ok>1</ok>\'); 14.}plurk 發文函式: 01.// 發文到plurk 02.// 2008/07/19 改 03.// $nick_name 是顯示名稱,如 klcintw 04.// $uid 是使用者代號,藏在網頁原始碼裡,如:"user_id": 30140 05.function post_plurk($nick_name, $pwd, $uid, $msg) { 06. $curl_handle = curl_init(); 07. curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); 08. // 認證 09. curl_setopt($curl_handle, CURLOPT_COOKIEJAR, \'cookie.txt\'); 10. curl_setopt($curl_handle, CURLOPT_COOKIEFILE, \'cookie.txt\'); 11. curl_setopt($curl_handle, CURLOPT_URL, \'http://www.plurk.com/Users/login\'); 12. curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "nick_name=$nick_name&password=$pwd"); 13. curl_exec($curl_handle); 14. // 發文 15. curl_setopt($curl_handle, CURLOPT_URL, \'http://www.plurk.com/TimeLine/addPlurk\'); 16. curl_setopt($curl_handle, CURLOPT_POSTFIELDS, \'qualifier=%3A&content=\' . urlencode($msg) . \'&lang=en&no_comments=0&uid=\'.$uid); 17. curl_exec($curl_handle); 18. curl_close($curl_handle); 19. return; 20.}認證失敗的回傳字串:login:/Users/showLogin?nick_name=ooxx&error=incorrect_login 2008/07/07 補充:因修改Permalinks造成FunP的推數消失。 |
廣利不動產-板橋在地生根最實在--新板特區指名度最高、值得您信賴的好房仲 完整房訊,房屋、店面熱門精選物件,廣利不動產 優質仲介,房屋租賃、買賣資訊透明,交易真安心! 廣利不動產-新板特區指名度最高、值得您信賴的好房仲 您的托付,廣利用心為您服務 |