- æ稿ããã¡ãã»ã¼ã¸ã¯ rawurlencode() ã§ã¨ã³ã³ã¼ããããã¡ãã»ã¼ã¸ã«ã¹ãã¼ã¹(空ç½)ãããã¨ãããã§åãã¦ãã¾ãããã
PHP5以ä¸
<?php
$url = "http://twitter.com/statuses/update.xml?";
$username = your username;
$password = your password;
$params = "status=". rawurlencode(message);
$result = file_get_contents($url.$params , false, stream_context_create(array(
"http" => array(
"method" => "POST",
"header" => "Authorization: Basic ". base64_encode($username. ":". $password)
)
)));
?>
PHP4ä»¥ä¸ (PHP3ã¯åãããªã)
<?php
$url = "http://twitter.com/statuses/update.xml?";
$username = your username;
$password = your password;
$params = "status=". rawurlencode(message);
$fp = fopen($url.$params, 'r', false, stream_context_create(array(
"http" => array(
"method" => "POST",
"header" => "Authorization: Basic ". base64_encode($username. ":". $password)
)
)));
$result = "";
while(!feof($fp)){
$result .= fgets($fp);
}
fclose($fp);
?>