A Guide to Mobile and Web Technology(LAMP)

Posts tagged ‘programatically’

How to update twitter status using php

The following lines of code are used to update your status in twitter.

//Text to be updated on twitter
$status = "Hi this is the text to be updated";
//your twitter username
$username = "xxxxusername";
//your twitter password
$password = "password";
$postvars = "status=".$status;
$url = "http://twitter.com/statuses/update.xml";</code>

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postvars);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);  // DO NOT RETURN HTTP HEADERS
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);  // RETURN THE CONTENTS OF THE CALL
$res=curl_exec($ch);
curl_close($ch);

How to send Sms from Android Programatically

The following lines of code are used to send sms from android phones. This will launch the default sms intent with a message

“Hi this is test sms”

and allows to enter the phone number and edit the message if necessary!

//call the default intent to launch message compose page

Intent sendIntent = new Intent(Intent.ACTION_VIEW);
//use to fill the sms body
sendIntent.putExtra("sms_body", "Hi this is test sms"); 
sendIntent.setType("vnd.android-dir/mms-sms");
startActivity(sendIntent);
Follow

Get every new post delivered to your Inbox.

Join 38 other followers