Archive for Januari 2012

App Update Twiiter




another night on my APBO learn even google-ing cool .....
I find something cool to learn programming for the web # let add smart
and I found how to create application status updates have our own twitter
required

 
1.http: / / classes.verkoyen.eu / twitter_oauth. (Its Twitter API)
2.https: / / dev.twitter.com / apps / new (to make applikasinya)

#nter all the form available
then you will get 2 codes the consumer key and consumer secret kept well .. it # code if need be locked in a strongbox hhe
You must change the API Application Access Type of Read Only (Default) to Read and Write in order to perform the update status. How do I change the Access Type of application Twitter
the steps>> a. b. click settings application type (Select read and write) c. create my token Accsess

 Next-->>

3. * create a php file (stored in one folder dilocal server)

 named index.php
script:

<html>
<head>
<title> Twitter ... oh Twitter </ title>
</ head>
<body bgcolor="aqua">
<center>
<b> Latest Status Update </ b>
<div id='UpdateStatus'>
<form action="proses.php" method="GET">
<table>
<tr> <td> Status </ td> <input type="text" <td> name="status"> </ input> </ td> </ tr>
<tr>
<td> </ input> </ td>
</ tr>
</ table>
<input type="submit" value="Update!">
</ form>
</ div>
<div id='ShowStatus'>


<? php
/ / PHP SCRIPT FOR FEATURING OUR STATUS UPDATE
/ / Edit the following idTwitter according to your account
$ idTwitter = 'id_twitter ';
/ / The number of status to be displayed on web pages, arranged as needed
$ showStatus = 10;

/ / Data Twitter status updates can be accessed via the following URL in a web service RSS
$ xml = simplexml_load_file ("http://twitter.com/statuses/user_timeline/". $ idTwitter.. "rss");

/ / Display data into the web interface rss
$ counter = 2;
foreach ($ xml-> channel-> item as $ data)
{
        echo "<p>";
        echo $ data-> pubDate. "<br>";
        echo $ data-> title;
        echo "</ p>";
        if ($ counter == $ showStatus) break;
        else $ counter + +;
}

?>
</ div>
</ center>
</ body>
</ html>


4.  * create a php file named proses.php
<? php
/ / Why not OAuth-Class include the script twitter.php
include 'twitter.php';

$ twitter = new Twitter ("<consumer-key> ',' <consumer-secret> ');

$ twitter-> setOAuthToken ('<access-token>');
$ twitter-> setOAuthTokenSecret ('<access-token-secret>');

/ / Retrieve value "status" of the form status at the index.php
$ status = $ _GET ["status"];

/ / Perform the insert / update / display status into Twitter
$ twitter-> statusesUpdate ($ status);

/ / Warning status if you entered has been successfully updated to Twitter
echo "Your status has been sent </ br>";
/ / Hyperlink so that we can easily
echo "<a href='http://localhost/update_twit/index.php'> Back </ a>";

?>


example the end result 
 

Posted in , , , | Leave a comment

Pages

Search

Sandiah Notes Template Sandroid11.blogspot.com.