æ¥è¨æ稿APIã追å ããServices_MixiAPI 0.2.0ãªãªã¼ã¹
via. http://ido.nu/kuma/2008/07/30/digging-mixi-for-iphone-application-and-new-api-for-posting-a-diary-with-a-photo/, mixi日記投稿用APIを使ってPHPからmixi日記にポスト | Creazy!
å人çã«ã¯å®å
¨ã«åºé
ããæãããã
http://ido.nu/kuma/2008/07/30/digging-mixi-for-iphone-application-and-new-api-for-posting-a-diary-with-a-photo/ã«ããã¨ãã©ããmixiã®APIã«æ¥è¨æ稿APIã追å ããã¦ããããããå
å¾è¼©ãmixi日記投稿用APIを使ってPHPからmixi日記にポスト | Creazy!ã§PHPã®ãµã³ãã«ã³ã¼ããå
¬éãã¦ã¾ãã
ã§ã
PEARåã«ã¤ãã¦ã¯shimookaããããããServices_MixiAPIã«è¿½å ã¨ããã¦ãããã¨ï¼åæã«ï¼æãè¾¼ãã§ããã®ã§æå¾ ãã¦å¾ ã¤äºã«ãã¾ãã
ããã¯ãã¨ã£ã¨ã¨ä½ãããã¨ãããã¨ã§ããï¼ããã§ããã
ã¨ãããã¨ã§ã以åããå
¬éãã¦ããServices_MixiAPIã«ç¡çç¢ççªã£è¾¼ãã§ã¿ã¾ããã
- http://www.doyouphp.jp/pear/Services_MixiAPI-0.2.0.tgzï¼alphaçï¼
ã¤ã³ã¹ãã¼ã«ã»ã¢ããã°ã¬ã¼ãã¯
$ sudo pear install -af http://www.doyouphp.jp/pear/Services_MixiAPI-0.2.0.tgz $ sudo pear upgrade -af http://www.doyouphp.jp/pear/Services_MixiAPI-0.2.0.tgz
ãªæãã§ã
使ãæ¹ã¯ãã£ã¨æ¬¡ã®ã¨ããã§ãã
<?php require_once 'Services/MixiAPI/Diary.php'; require_once 'Services/MixiAPI/Image.php'; require_once 'Services/MixiAPI/Factory.php'; error_reporting(E_ALL); /** * $user,$pass,$idãé©å®æ¸ãæãã¦ãã ãã */ $user = '[mixiã®ãã°ã¤ã³ID]'; $pass = '[mixiã®ãã¹ã¯ã¼ã]'; $id = '[mixiã®ã¦ã¼ã¶ã¼ID]'; /** * æ¥è¨ãªãã¸ã§ã¯ãã®ä½æ */ $title = 'Services_MixiAPIã使ã£ãæ稿ãã¹ã'; $subject = <<< EOD mixiãè£ã§è²ã ã¨ç¨æãã¦ããã¿ããã§ããã ããããã¨ããatomï¼WSSEèªè¨¼ã§é ä¿¡ããã¦ãããããªã®ã§ã試]]>ãã¦ã¿ã¾ãããWSSEèªè¨¼ã«ã¤ãã¦ã¯ä»¥ä¸ãåç §ã¨ãããã¨ã§ã * Web Services Security UsernameToken Profile 1.0ï¼pdfï¼ * ã¯ã¦ãªããã¯ãã¼ã¯AtomAPIã ã®WSSEã ã® * ã¯ã¦ãªãã©ãã©ã¤ãatomapiã¨ã¯ - ã¯ã¦ãªãã¤ã¢ãªã¼ 以ä¸ãµã³ãã«ã§ãããX-WSSEãªã¯ã¨ã¹ããããã®å 容ãä½ã£ã¦ããé¨åã¯ãPEAR::Services_Hatenaã¨Services_Hatena - PHPã®ææ¦ (ããºã¬æ¥è¨)ãåèã«ããã¦ãããã¾ããã ã¤ã¼ããã»ã¨ãã©ãã®ã¾ã¾ã§ãã ;-) EOD; $diary = new Services_MixiAPI_Diary($title, $subject); /** * mixiã¯jpegã®ã¿å¯¾å¿ãªã®ã§æ³¨æ */ $diary->setImage(new Services_MixiAPI_Image('/path/to/jpeg_file.jpg')); /** * æ¥è¨æ稿APIãªãã¸ã§ã¯ãã®ä½æ */ $service = Services_MixiAPI_Factory::getInstance( Services_MixiAPI_Factory::API_MODE_POSTDIARY, $user, $pass, $id); /** * æ¥è¨ãªãã¸ã§ã¯ããã»ãã */ $service->setDiary($diary); /** * ãªã¯ã¨ã¹ãéä¿¡ */ $service->execute(); /** * çµæã®XML */ var_dump($service->get());
Services_MixiAPI_Diaryãªãã¸ã§ã¯ãã«Services_MixiAPI_Imageãªãã¸ã§ã¯ããçªã£è¾¼ãã§ããã¨ãç»åä»ãã®æ¥è¨ãæ稿ã§ãã¾ãããã®è¾ºã®è©±ã¯mixi日記投稿用APIを使ってPHPからmixi日記にポスト | Creazy!ãåç §ãã¦ãã ãããServices_MixiAPI_Imageãªãã¸ã§ã¯ãããªãå ´åã¯ãåçãªãã®æ¥è¨ã«ãªãã¾ãã
ã³ã¼ãã§ããããã¤ãéãCodeReposã«ä¸ãã¦ããã¾ãã
Services_MixiAPI 0.1.xç³»ã¨API(interfaceçãªæå³)ãããªãéã£ã¦ããã®ã§ãããã¨ããããServices_MixiAPIã¯ã©ã¹ã«__callã¡ã½ããã追å ãããã¨ã§éãã¦ãã¾ããããããããAPIãéãã®ã§ãããªæãã«ãªã£ã¦ã¾ããããããã¼ããã®è¾ºãã©ãã«ããããï¼
ãã¨ãã³ã¡ã³ããçµæ§é©å½ã§ãï½