Shortest piece of php code to update twitter status
There are huge resources of php to update twitter status using API. But a few days back i found a very small piece of php code to update twitter status which uses stream. Here are the code –
$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);
Put username, password, message as needed. I think this is the php shortest code ever to update twitter status. Enjoy!
Users Export/Import – EE to WordPress
A few days ago i’ve imported about 40000+ subscribers from expressionengine to wordpress. It’s a very easy job but for huge data – it came to a issue to me. Here are the step by step stuffs that i followed. This may help you ![]()
Read the rest of this entry »
My Wishlist for 2010
1. Want to be father ![]()
2. Zend PHP5 Certification
3. Get a Macbook Pro 15 inch
4. Get a Nikon D90
php 5 oop gotchas you must know
I was reading php 5 oop stuffs from http://php.net site, few things i noted for myself, these you should learn too if aren’t yet, so go on. These notes taken from php.net –
Inheritance – It is not possible to extend multiple classes; a class can only inherit from one base class.
Static – To access a static property, we can use self var inside class like echo self::$foo;
Read the rest of this entry »
Cakephp, Auth and Empty Password Problem
Auth component is excellent one that i love in Cakephp for authentication but one problem i faced with this, empty password problem. That is – to add a new user, it takes empty password if we use password field. Model validation doesn’t work for password field if we put no value in password field, because – auth component create a hashed password after the form submission with empty value, so it can pass Model validation easily. I solved it another way – here is it.
Read the rest of this entry »