I am working on a project for the Twitter API usage, which integrates the CURL function. The project's shortcomings have been listed under 'Features to Include'. You can support me in this by committing to the work.
To be able to use it, you should download the TwitterClass.php
file and include it to your page as shown below.
<?php
session_start();
include("TwitterClass.php");
?>
Type in your API data in the CONSUMER_KEY
and CONSUMER_KEY_SECRET
spaces within the Twitter variable.
In the friendships/create field you will need to type in the names for the API JSON file(Twitter API Page). For example: friendships/destory
etc.
JSON | Operation | Parameter |
---|---|---|
friendships/create | screen_name | sercanarga |
statuses/update | status | Hello World! |
... |
In the array field you need to type in the parameters that you want. The example shown below will make you follow the Twitter user named sercanarga.
true = Debug Mode On false = Debug Mode Off
$twitter = new Twitter('CONSUMER_KEY', 'CONSUMER_KEY_SECRET');
$status = $twitter->post('friendships/create', ['screen_name' => 'sercanarga'], true);
if ($status == 1) {
echo 'Success!';
} else {
echo 'Error!';
}
- GET Method
Oauth MethodPOST Method