ãä¹ ãã¶ãã§ããã¾ãã
ãä¹
ãã¶ãã§ããã¾ããã
é次ã§ãã
ããªãã¯æ°ä½ã»ã¼è¦éãã¾ããã
ã¯ã©ã¤ããã¯ã¹å¯¸åã§æ°ã¥ããªãã¦â¦
ã¨ãããããçãã¦ã¾ã
1å¹´ãããã¡ãã£ã¨botã«å°å¿µã§ããªãç¶æ³ã§ãã
ã¯ã½ã©ãã§ãããçç±ãªãã§ããã
å°±è·æ´»åã¨ããã¼ããææ¥ã¨ç 究ã¨ããâ¦
ããã¾ããããªãã
ç¾å¨ãNNTï¼å
ã
å®ã§ã¯ãªãç¡ãå
å®ï¼ã§ä¿ºãã¡ã®æ¦ãã¯ç¶ããã¿ãããªæãã§ãã°ã°ã°ã°ã°
ç§æ
ã§ç³ã訳ãªãã®ã§ããããã®æ¦ããçµããã¾ã§botã®ç®¡çã ããã¦ããããã¨æãã¾ããåºæ¬ã
NNTããANTã«ãªããããã®ã§ãã
ã¹ãã¼ã¹ãå ¥ã£ã¦ãåå¿ã§ããã½ã¼ã¹
ãããããã«é常ã«åèã«ãªãã½ã¼ã¹ãè²¼ã£ã¦ããã ããã®ã§ãã¡ã¢ãã¾ã
else if(stristr($com, "ã¤")){
if(preg_match("/ç
è|ãã°ã|ã¿ãã³/u",$com) > 0){
$key = array_rand($tabako);
$post = $tabako[$key];
$return =$reply_name." ".$post;
}
}
ãã®ã½ã¼ã¹ã§
ã»ãç
èããã°ããã¿ãã³ããªã©è¡¨è¨ãå¤ãã¦ãèªèããããã«ããã
ã»ãã¤ç
èãã©ããããªã©ãã¹ãã¼ã¹ãå
¥ã£ã¦ãæ©è½ããããã«ã
ã»ãã¤ç
èãã ãã§ãæ©è½ããããã«ããã
ã¨ãããã¨ãã§ããããã§ãã
ã¨ãããã¨ã¯â¦ãããã§ã½ã¼ã¹ãæ´çã§ãããã§ãï¼
ä»ã¾ã§ã²ãããªãã«ã¿ã«ããåè§ã«ã¿ã«ãã§åãã¦ããã®ãã
ããã§ããªããã£ããããããã¨ãã§ãããï¼
ããããããæ¬å½ã«ãããã¨ããããã¾ãï¼
追è¨
blackcatãããã³ã¡ã³ãæ¬ã«ãæ°ãã¤ããªãã¨ãããªãä¾ããæ¸ãã¦ãã ãã£ã¦ãã¾ãï¼
ãã°ããããã以å¤ã®æããç
èã¯ä½ã«æªãããæ°ãã¤ããæ¹ãè¯ããããªã©ã¨ãããããªãªãã©ã¤ããã¦ããã°ãããããåå¿ãè¿ã£ã¦ããããã§ãã
ãã®å ´åãèæ
®ãã対å¦æ³ãæ¸ããã¦ããã®ã§ããã¡ãããã²åèã«ãã¦ãã ãããã¼ï¼
blackcatãããããã¨ããããã¾ããï¼
ãããã¨ããããã¾ãâ¦ï¼ãããã¨ããããã¾ãâ¦ï¼
ä¸æ¬æãªããã¡ããã¡ããã¨å¿ãããå éãã¦ããä»æ¥ãã®é ã§ãã
ã質åãã¦é ããã³ã¡ã³ãã«çãã¦ãããçæ§ãæ¬å½ã«ãããã¨ããããã¾ãã
1ã¤ç®ã®ãããã¨ããããã¾ãâ¦ï¼ã¯ããã§ãã
2ã¤ç®ã®ãããã¨ããããã¾ãâ¦ï¼ã¯ç¸æ£botãå
å®ãã¦ãããã¨ã§ãã
ç¸æ£ãªã¹ãããã³ãã³ï¼
å¬ããï¼
ï¾ï¾ï¾ï¾ãã¡ããï¼
質åã³ã¡ã³ãããã¦ãã ãã£ãæ¹ã¸
ããã«çããããªãã¦ããããªããã§ãâ¦ã
cronãã°ã¬ã¾ãã
æ°å¹´æ©ã
cronãã°ã¬ã¾ããã
ç§ã¯ãªãã¨ãcronãè¦ã¤ãããã¨ãã§ããåãããè¿äºãã§ããããã«ãªãã¾ããã
ãã¾ãã¾è¦ã¤ãããã¨ãã§ããã®ã§ãã©ããã¼ã¨ããè¨ããããããã¾ããã
ç§ãã©ã®cronã使ã£ã¦ãããã質åãªããã®ã¯ãé æ
®ãã ããã¾ãã
æ¬å½ã¯ãã使ã£ã¦ããï¼ã¨è¨ãããã®ã§ãããä»åã®ããã«ãªã£ã¦ã¯å°ãã¾ãã®ã§â¦ï½
å¿æ´ããã§ããªããã¨ãä½ããæããã
æ¸ãããã±ãããã¼ãªï¼ã¨æãããããã¾ãããâ¦ããããªããã
Test OAuth update.ãæ稿ã§ããªãããªãã¸
2010å¹´6æã«Basic Authã¯å»æ¢äºå®â¦ãªã«ããããã
ã¤ã¼ãã¨ã§é
ããªããããå°ãã ãOAuthã«æãã¤ãã¦ã¿ãã
http://wolf.silk.to/labo/oauth.html
ãè¦ãã°ã»ã¨ãã©ã®äººãããTest OAuth update.ãæ稿ã§ãã¾ãã
ã ãããããèªåã¯ã»ã¨ãã©å¢ã«å
¥ããªãã£ãã
ã©ãã§å¼ã£ããã£ããç´¹ä»ãã¾ãã
ã¾ãoauth_test.phpã§å¼ã£ãããã¨ããã
ããåæ段éã§å¼ã£ããã£ãã
å®è¡ããã
ä¸ã®æ¹ã«
Warning: array_merge() [function.array-merge]: Argument #2 is not an array in (çç¥)OAuth.php on line 249
ãåºã¦ãä¸ã®æ¹ã«ã¯
/account/verify_credentials.xml
Could not authenticate you.
ãåºãã
ã¾ãããã§å¼ã£ããã£ã人ã¯OAuth.phpã«ãã
if ($token)
$defaults['oauth_token'] = $token->key;$parameters = array_merge($defaults, $parameters);
return new OAuthRequest($http_method, $http_url, $parameters);
ã®
$parameters = array_merge($defaults, $parameters);
ã«
$parameters = array_merge($defaults,(array)$parameters);
ã¨ããããã«(array)ãå ãã¦ãã ããã
ããã¨ããä¸æè°ã
ä¸ã®ã¨ã©ã¼ãã¿ãã¨æ¶ããã
次ã¯ä¸ã®ã¨ã©ã¼ãæ¶ãã
oauth_test.phpã«ãã
$content = $to->OAuthRequest('https://twitter.com/account/verify_credentials.xml', array(), 'GET');
ã®GETã®ä½ç½®ãå¤ããã
$content = $to->OAuthRequest('https://twitter.com/account/verify_credentials.xml', 'GET', array());
ãããããµãã«ã
ããã¦ãå®è¡ããã¨ããä¸æè°ï¼
ä¸ã®ã¨ã©ã¼ãã¿ãã¨å人æ
å ±ã«ï¼
å®éã«PHP+OAuthã§Twitterã«POSTããã®ããã°ã©ã ãå®è¡ããã¨ãã
$req = $to->OAuthRequest("https://twitter.com/statuses/update.xml",array("status"=>"Test OAuth update."),"POST");
ã
$req = $to->OAuthRequest("https://twitter.com/statuses/update.xml","POST",array("status"=>"Test OAuth update."));
ã«ç´ãã¦ããã¦ãã ããã
å°ãã§ããå½¹ã«ãã¦ãã°å¬ããã§ãã
追è¨
[2009/12/16] twitterOAuth.phpã®ãã¨ã§ãææããã£ãã®ã§ãä¿®æ£ãã¾ããããã®èª¬æã§ã¯ãã¼ã¸ã§ã³0.1.1ã使ã£ã¦ãã¾ãã
ç´¹ä»ãã¦ããã ãã¦ãããµã¤ãããã§ã®ææã¨ããã®ã¯ããã¼ã¸ã§ã³0.1.1以å¤ï¼0.2.0-betaãªã©ï¼ã使ã£ã¦ãã¾ã£ãããã«ã¨ã©ã¼ãåºã¦ããã¨æããã¾ãã
ãtwitterOAuth.phpãã§ããããtwitteroauth.phpãã§ã¯ããã¾ãããã注æãã ããã
ã³ããã§ããã¾ããã
ã¿ãªããããã¼ã¸ã§ã³ã«æ³¨æã§ããï¼
ææ¥ã®ãã£ã¦è¿çå¤æ´
if( !preg_match ( "/RT/", $var ) ){ $name = $XML->status[$i]->user->name; $id = $XML->status[$i]->id; $now_d = $XML->status[$i]->created_at;ãâãªãã©ã¤ãããæ¥æ $message = serif($reply_name,$name,$com,$now_d); tweet($message ,$username,$password,$id); }
function serif($reply_name,$name,$com,$now_d){ $yasumu=array("ããã§ããâ¦ãããã¿ãªã®ã§ã¾ã£ããããã¦ããã ãã¾ãã", "ãµã â¦ããã§ãããã§ã¯ããããããã¨ã«ãã¾ãã"); $yasumanai=array("ä»æ¥ã¯å¹³æ¥ã§ããï¼ã¾ãã俺ã¯æãªãã§å¤ãããªãã§ããã", "ä¼ãã¨æä¸ããã«æããã¦ãã¾ãã¾ãï¼ï¼"); else if(stristr($com, "ä¼ã")){ if(stristr($now_d, "sun")){ $key = array_rand($yasumu); $post = $yasumu[$key]; $return = $reply_name." ".$post;} else if(stristr($now_d, "sat")){ $key = array_rand($yasumu); $post = $yasumu[$key]; $return = $reply_name." ".$post;} else{ $key = array_rand($yasumanai); $post = $yasumanai[$key]; $return = $reply_name." ".$post;} }
var_dump($XML);ã¨var_dump($now_d);
ããã¦è¦æ¯ã¹ã¦ãããã¨æãã¾ãã
preg_matchã使ãã°ãã£ã¨ã¹ãã¼ãã«ãªãã¾ãã
ã¡ãã£ã¨èªç±
$tea1=array("ãã¼ã¸ãªã³ã¹ãã¬ã¼ããã£ã¼",
"ãã«ã®ãª",
"ã¢ããµã ãã«ã¯ãã£ã¼",
"ã¦ã´ã¡ãã«ã¯ãã£ã¼");
$key1 = array_rand($tea1);
$post1 = $tea1[$key1];
$tea2=array("ç´ è¶ã§ããâ¦æä¸ããã®ã§ãããâ¦ã¯ããã¤[".$post1."]",
"ä»ãã³ã¼ãã¼ããããã¾ãããããã¾ããã",
"äºè§£ã§ããã¤[".$post1."]");
else if(stristr($com, "ãã ãã")) {
else if(stristr($com, "ç´ è¶")){
$key2 = array_rand($tea2);
$post2 = $tea2[$key2];
$return =$reply_name." ".$post2;}
}
俺å¾ç¥æ¸åbotã®ã½ã¼ã¹ã®1é¨ã§ãã
ãã£ã¨ããæ¹æ³ãããã®ããããã¾ãããã
ãããªæãã§ç´
è¶ãããã以å¤ã®ãã¨ãã§ããããã«ãã¾ããã
åããã®æ©ã¿ãªãã§ãããå®æçºè¨ãã©ã³ãã ã«ãªããæ¯æ¥åãå°è©ãè¨ã£ã¦ãã¾ããã§ãã
ã©ãã«ãç´ããããã§ããâ¦ããæ¹æ³ãããã°æ¯éã¨ãæãã¦ãã ããã