Tweeting from PHP Comments Off

Thanks to fabien Potencier for this hint :

Twitter is everywhere nowadays. Odds are eventually you will want to tweet from PHP. No need to use one of the numerous PHP Twitter libraries, as tweeting is as simple as using the PHP built-in file_get_contents() function:
function tweet($message, $username, $password)
{
$context = stream_context_create(array(
'http' => array(
'method' => 'POST',
'header' => sprintf("Authorization: Basic %s\r\n", base64_encode($username.':'.$password)).
"Content-type: application/x-www-form-urlencoded\r\n",
'content' => http_build_query(array('status' => $message)),
'timeout' => 5,
),
));
$ret = file_get_contents('http://twitter.com/statuses/update.xml', false, $context);

return false !== $ret;
}

Pretty easy, no? Using the tweet() function is of course a piece of cake:
tweet(‘From PHP, yeah…’, ‘fabpot’, ‘Pa$$’)

;

source : http://fabien.potencier.org/article/20/tweeting-from-php

Tags: devloppement, PHP, twitter

Twitter act as an email-discover for spam-bot ? Comments Off

it seems that with this little php-code :
$file = file_get_contents("http://search.twitter.com/search?q=gmail.com+OR+hotmail.com++OR+%22email+me%22");
$file = strip_tags($file);

preg_match_all(
"([a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum)\b)siU",
$file,
$matches);

print_r($matches);

Anyone can grab emails displayed on twitter recently … It just wanted to test this and it works :
image-6
People really have to learn what is internet and what is a bot … do never leave your email on a public page !

via http://twitter.com/_kemar/status/1804577430

Tags: bot, email, spam, twitter, Web