PHP 4 Twitter Class
Posted on January 28, 2009 - Filed Under Code, Projects | 2 Comments
I say class, it’s actually just 1 function for PHP 4+ to allow sending of twitter messages really simply.
Based upon the PHP 5 twitter class by David Grudl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function twitter_send($message, $user, $pass)
{
$url = ‘https://twitter.com/statuses/update.xml’;
$post = array(’status’ => $message);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_USERPWD, $user.":".$pass);
curl_setopt($curl, CURLOPT_HEADER, FALSE);
curl_setopt($curl, CURLOPT_TIMEOUT, 20);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(’Expect:’));
if ($post) {
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, [...]








