App Update Twiiter

*ini hanyalah postingan lama ku

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

1.http: / / / twitter_oauth. (Its Twitter API)
2.https: / / / 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

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

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

<? php
/ / 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 ("". $ 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

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s