Jump to content

twitter api help. willing to pay


janinexd

Recommended Posts

I know php but i cant seem to write correctly the functions. :s

try http://www.oaxd.com

 

the authentication thing works but i want it when authenticated to have a text area and a post_tweet function. i hope you understand what i mean. im a noob at this.

 

tell me how much you need by working on this

------------------

more info about the script

  Quote
This script allows you to let your user login using their existing Twitter account to your site, with some simple code, you can allow a login to your site using Twitter.

 

In addition to this, the script offers a simple fuction ‘post_tweet()’ to simply post an update through a twitter account.

 

As well as enabling you to post tweets, and authenticate users, when a user is logged in, the script will provide you with information about their user. Such as:

- Screen Name

- Real Name

- Picture/ Avatar

- Followers

 

Unlike other Twitter OAuth scripts, this one also generates the required unique URL ’s for each user, so you don’t have to do any additional requests.

 

This script is quite hard to demo, but i’ve included a small demo of how the login process is, and an example of the data you can access.

 

here's what it says on the read me:

  Quote
Step 1: Upload

//

 

Upload the 'twitter' directory to your server, you can name the folder anything you wish.

 

 

 

//

Step 2: Config

//

 

Follow the instructions in the 'config.php' file on how to obtain access tokens from Twitter. You will only need to do this once, it's a method of authenticating your application/ script with Twitter.

 

 

//

Step 3: Test

//

 

We've included the file 'mytest.php' with your download. This allows you to test that everything is working okay, if you've followed the last two steps correctly then the 'mytest.php' file should run. When you're logged out of twitter, it displays the Login URL, use this to login to Twitter. Once completed, you should return to that page, if everything is working, insead of a 'login' link, you should see an array of data about the logged in user, similar to the following one:

 

Array

(

    [username] => the_dream

    [picture] => http://s3.amazon...

    [authenticated] => 1

    [followers] => 671

    [name] => Christian Owens

    [login] => n/a

)

 

 

//

USAGE

//

 

Basically, to use the script, you're going to need to include the following file:

twitter/twitter.php

 

To check if a user is authenticated, check the variable $twitter['authenticated'] if the user is authenticated, this variable will return a 1, if not, a 0. This script does contain some loose user session control, but this script is meant to be used as a means for you to be able to create your own applications, so you can use this data to create a login system.

 

If the user is not logged in, a login link is provided using the variable $twitter['login'] this link is the OAuth link, it is specifically generated for that user.

 

Once a user is logged in, you can find out the following information about them using the following variables...

Screen Name: $twtter['username']

Avatar/Picture: $twitter['picture']

Follower Count: $twitter['followers']

Real Name: $twitter['name']

 

If you then want to send a tweet through an authenticated users account, you can use the function post_tweet() in the following format:

 

post_tweet("The message to be posted here!");

Link to comment
https://forums.phpfreaks.com/topic/181127-twitter-api-help-willing-to-pay/
Share on other sites

Heres a simple twitter script, just update the username and password with your user/password for twitter

 

function postToTwitter($message, $username = "mrwoot", $password="123456"){

    $host = "http://twitter.com/statuses/update.xml?status=".urlencode(stripslashes(urldecode($message)));

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $host);
    curl_setopt($ch, CURLOPT_VERBOSE, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
    curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
    curl_setopt($ch, CURLOPT_POST, 1);

    $result = curl_exec($ch);
    // Look at the returned header
    $resultArray = curl_getinfo($ch);

    curl_close($ch);

}

 

then you can just use

 

postToTwitter("hello world");

 

to post to twitter :) I'm using it for my ASPC processing twitter account

 

http://twitter.com/aspcprocessing

 

bare in mind there isnt any error checking on this simple script.

  Quote

Heres a simple twitter script, just update the username and password with your user/password for twitter

 

function postToTwitter($message, $username = "mrwoot", $password="123456"){

    $host = "http://twitter.com/statuses/update.xml?status=".urlencode(stripslashes(urldecode($message)));

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $host);
    curl_setopt($ch, CURLOPT_VERBOSE, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
    curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
    curl_setopt($ch, CURLOPT_POST, 1);

    $result = curl_exec($ch);
    // Look at the returned header
    $resultArray = curl_getinfo($ch);

    curl_close($ch);

}

 

then you can just use

 

postToTwitter("hello world");

 

to post to twitter :) I'm using it for my ASPC processing twitter account

 

http://twitter.com/aspcprocessing

 

bare in mind there isnt any error checking on this simple script.

 

thanks for this :D

  • 2 weeks later...

Ive just submitted a twitter api that covers your needs and is simple to use

 

its as simpel as

include 'Twitter/Twitter.php'; 
$Twitter = new Twitter('username','password'); // this will set the credentials used throughout the twitter api 

$status = $Twitter->Status->update(array('status' => "This is a new status set by the PHP TAPI."));
if($status){
    echo "New status:" . $Twitter->Status->get();
}

 

http://www.phpclasses.org/browse/package/5799.html

 

enjoy

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.