PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Felix Oghina   Twitter   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example usage script
Class: Twitter
Update the status of a Twitter user
Author: By
Last change: Comment typo
Date: 15 years ago
Size: 713 bytes
 

Contents

Class file image Download
<?php

require "Twitter.class.php";

// Instantiate a Twitter object with a given username and pasword
// If a third argument is set to true, Twitter will be in debug mode which will
// output incoming and outgoing data.
$tweet = new Twitter("username", "password");
// Set a new status. This can be called multiple times on the same object.
// The update() function returns true if the status update was successful or
// false if an error occured. In case of an error, a string describing the error
// is stored in the error variable of the object (in our case $tweet->error)
$success = $tweet->update("PHP rocks my socks!");
if (
$success) echo "Tweet successful!";
else echo
$tweet->error;

?>