Twitter Bot : Post Qoutes to twitter automaticly via PHP 

I made this code for my personal use but now thought of sharing this it over here.On execution this PHP will post a tweet in your profile via twitter api . Tweet will have a beautiful quote or saying.Set this PHP execution over a cron job or scheduled jobs.

<?php
echo realpath("twitter.php");
echo 
"<br>";

$type[0]="love";
$type[1]="friendship";
$type[2]="life";
$type[3]="funny";
$type[4]="inspirational";
$type[5]="money";
$type=$type[rand(0,5)];
$curl curl_init();
curl_setopt($curlCURLOPT_URL"http://www.quotesdaddy.com/widget/tag/$type");
curl_setopt($curlCURLOPT_CONNECTTIMEOUT2);
curl_setopt($curlCURLOPT_RETURNTRANSFER1);
$q curl_exec($curl);
curl_close($curl);
$q=explode("&ldquo;",$q);
$q=explode("&rdquo;",$q[1]);
$q=$q[0];
$username '[username]';
$password '[password]';
$status urlencode(stripslashes(urldecode($q)));

if ($status) {
$tweetUrl 'http://www.twitter.com/statuses/update.xml';

$curl curl_init();
curl_setopt($curlCURLOPT_URL"$tweetUrl");
curl_setopt($curlCURLOPT_CONNECTTIMEOUT2);
curl_setopt($curlCURLOPT_RETURNTRANSFER1);
curl_setopt($curlCURLOPT_POST1);
curl_setopt($curlCURLOPT_POSTFIELDS"status=$status");
curl_setopt($curlCURLOPT_USERPWD"$username:$password");

$result curl_exec($curl);
$resultArray curl_getinfo($curl);

if ($resultArray['http_code'] == 200)
echo 
'Tweet Posted';
else
echo 
'Could not post Tweet to Twitter right now. Try again later.';

curl_close($curl);
}
?>