Giter VIP home page Giter VIP logo

tmhoauth's People

Contributors

jvlgrab avatar shiki avatar tantek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tmhoauth's Issues

Streaming API output to web browser

Hi Matt,

is there any way to output (handle) the output of the streaming api (streaming.php) to direct it to a web browser? I mean, currently it outputs to console very well as I tested it, but when I run it in Chrome it does not.

Is streaming API rate limited by the same REST API rules?

I would appreciate some help here!, thanks!

Adding extra parameters to API calls

Hi there!
I don't really know if this is an issue of your library or a a Twitter API fault, but i can't get the querys to work if I add extra parameters to them.
Example:
$tmhOAuth->request('GET', $tmhOAuth->url("1/statuses/mentions"));
$mentions = json_decode($tmhOAuth->response['response']);
This works fine.
$tmhOAuth->request('GET', $tmhOAuth->url("1/statuses/mentions?since_id=$lasttweet"));
$timeline = json_decode($tmhOAuth->response['response']);
Where $lasttweet is a positive integer, smaller than the last reply's id. $timeline is empty.

Regards, & thanks in advance ^.^

Issue with photo_tweet.php

Issue like this #2, for clearance of experiment I changed only authorzation keys and add image.jpg to the example folder. After that i got an error like "[error] => failed creating formpost data [errno] => 26". Curl ver 7.2. Trying to fix it, but I'm not a coder (I programming in php just for fun and pleasure, not for work). So, have i nice day and sorry for my english))

Suggestion: Add options to trate IDs as String.

Hi there!

The high use of twitter have generated really HUGE IDs for everything: Statuses, Users, DMs...
When moving large amounts of data, storing that IDs as Integers requires A LOT of memory to be allocated, and also so much CPU usage. The apps could be too much smaller if you could add an option to return these IDs as Strings instead of Integers.
Just an idea, not sure if possible :S

Best regards, Roobre.

Using examples/search.php clarification

Hi, first of all, thanks a lot for this library, it sure seems like it is easy enough to learn.
With that said, I have a question regarding the use of this example, as it's not very clear to me.

I'm keeping the code mostly as-is, except for the parameters:

$params = array(
  'q'        => 'Search Query',
//  'since_id' => 'Get results since this ID (or leave blank for earliest allowed)',
//  'pages'    => 'How many pages should be retrieved?',
//  'rpp'      => 'Results per page (default 15)',
//  'max_id'   => 'Max ID to accept. This isn\'t sent to Search but instead used to filter the received results',
//  'geocode'  => 'Geo co-ordinates (e.g. 37.781157,-122.398720,1mi)',
//  'lang'     => 'Restrict results to a specific language? (en,fr,de etc)'
);

If I load the page on my test server (question: is this meant to be loaded from a web browser?) I get this:
Strict Standards: Non-static method tmhUtilities::read_input() should not be called statically in E:\xampp\htdocs\twitter2\examples\search.php on line 20
Search Query:
Notice: Undefined index: pages in E:\xampp\htdocs\twitter2\examples\search.php on line 25
Received page 1 http://search.twitter.com/search.json?page=1 There was an error. string(55) "{"error":"You must enter a query."}"

Any ideas on what I'm doing wrong?
Again, thank you very much.

Proxy needed

Hey! Awesome library, works great! I've added a few lines so it can proxy requests:

  • On the constructor: 'curl_proxy' => false,
  • On the cURL handler init: curl_setopt($c, CURLOPT_PROXY, $this->config['curl_proxy']);

It 'd be great to have this option of the further releases!
Thanks!

Retrieving Direct Messages

Hi This line does not do it

$code = $tmhOAuth->request('GET', $tmhOAuth->url('1/direct_messages.json'), array(
'data' => 'count=1&page=1'));

Would appreciate help if possible

Call to undefined function curl_init()

Fatal error: Call to undefined function curl_init() in C:\xampp\htdocs\TwitterApp\tmhoauth\tmhOAuth.php on line 567

The error I get when trying to recreate your simple tweet example, would you have any input on this?

Strict Standards: Non-static method tmhUtilities::pr() should not be called statically in E:\xampp\htdocs\themattharris-tmhOAuth-d0b0bc6\examples\entities.php on line 85

Strict Standards: Non-static method tmhUtilities::pr() should not be called statically in E:\xampp\htdocs\themattharris-tmhOAuth-d0b0bc6\examples\entities.php on line 85

Strict Standards: Non-static method tmhUtilities::is_cli() should not be called statically in E:\xampp\htdocs\themattharris-tmhOAuth-d0b0bc6\tmhUtilities.php on line 157

when i run http://localhost/themattharris-tmhOAuth-d0b0bc6/examples/entities.php

Uploading files from memory

I am wondering if it is possible to upload file from the memory to twitter, instead of storing it first on a disk.
Thanks!

"Could not authenticate with OAuth"

Hi,

First of all, I'd like to say that your OAuth lib is definitely the most user-friendly. However, I stumbled upon a (perhaps small) issue. I used your 'tweet.php' example to tweet a message with the following code:

'XXXXXXXXXXX', 'consumer_secret' => 'XXXXXXXXXXXXXXXXXXXXXX', 'user_token' => 'XXXX-XXXXXXXXXXXXXXXXXXX', 'user_secret' => 'XXXXXXXXXXXXXXXXXXXXXX')); $code = $tmhOAuth->request('POST', $tmhOAuth->url('1/statuses/update'), array('status' => 'My Twitter Message')); tmhUtilities::pr(json_decode($tmhOAuth->response['response'])); ?>

I also created an app at dev.twitter.com and filled in all fields with the data on that page (consumer_key = Consumer Key, consumer_secret = Consumer Secret, user_token = Access Token, user_secret = Access Token Secret).

When I load the page, I get the following error message;

stdClass Object
(
[error] => Could not authenticate with OAuth.
[request] => /1/statuses/update.json
)

What's wrong here?

Thanks in advance, and keep up the good work!

-Kjeld

User Lookup returning Error after a few attempts

Am not sure whats the issue..but I have spend hours trying to figure out what exactly is going wrong...
I am using user/lookup with multiple user_ids.. everything goes fine during the first few attempts..but when I loop through it more than 6-7 times following errors start popping up
"code":18,"message":"Too many terms specified in query"

any suggestions will be appreciated.
Thanks

Could not authenticate with OAuth (II).

Hi again Matt.

I keep using your library (it was easy with the code you provided; i almost had to do none reestructurement of the full program).

However, to the moment of thruth, fails at the same moment than the other library (so i suppose it could be a non related issue, but who knows...). I dumped the response['info'] variable and i got this:

{"error":"Could not authenticate with OAuth.","request":"/1/statuses/update.json"}

array(22) { ["url"]=> string(46) "https://api.twitter.com/1/statuses/update.json" ["content_type"]=> string(31) "application/json; charset=utf-8" ["http_code"]=> int(401) ["header_size"]=> int(880) ["request_size"]=> int(520) ["filetime"]=> int(-1) ["ssl_verify_result"]=> int(0) ["redirect_count"]=> int(0) ["total_time"]=> float(0.98396) ["namelookup_time"]=> float(0.04196) ["connect_time"]=> float(0.243824) ["pretransfer_time"]=> float(0.751436) ["size_upload"]=> float(7) ["size_download"]=> float(100) ["speed_download"]=> float(101) ["speed_upload"]=> float(7) ["download_content_length"]=> float(100) ["upload_content_length"]=> float(0) ["starttransfer_time"]=> float(0.982842) ["redirect_time"]=> float(0) ["certinfo"]=> array(0) { } ["request_header"]=> string(513) "POST /1/statuses/update.json HTTP/1.1 User-Agent: ARbTot Host: api.twitter.com Accept: / Accept-Encoding: deflate, gzip Authorization: OAuth oauth_consumer_key="*", oauth_nonce="8deb6d0be9e8fcf8427d0535702c12ff", oauth_signature="CXTJgfaWljHCgugrRAhy3xUlmfw%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1330655558", oauth_token="**", oauth_version="1.0" Content-Length: 7 Content-Type: application/x-www-form-urlencoded " } string(0) "" 0

POSTED // This is supposed to happen when tweet is succesfull: write POSTED and the tweet:

RT @mowgdrums @cigarete_smoke @moon_glasses Esta claro, aunque yo soy mas de M. #llamadmerebeldesiquereis @manualpuente LOOOOOOOOOL!!!

And this is the code belonging to that output:

$ckey, 'consumer_secret' => $csec, )); $code = $tweet->request('POST', $tweet->url('1/statuses/update'), array( 'status' => $string )); if ($code == 200) { tmhUtilities::pr(json_decode($tweet->response['response'])); var_dump($tweet->response['info']); var_dump($tweet->response['error']); echo $tweet->response['errno']; echo "POSTED\n"; } else { tmhUtilities::pr($tweet->response['response']); var_dump($tweet->response['info']); var_dump($tweet->response['error']); echo $tweet->response['errno']; echo "POSTED\n"; } } ?>

So i got the error: {"error":"Could not authenticate with OAuth.","request":"/1/statuses/update.json"}

Hope given enough debug info. Actually, with the other library (twitterOAuth) i had the same problem. It posted 3 spreads of ~ 100 tweets, then broke. Changed twitter account and made a new app. Double checked the keys and secrets. What i'm missing?

Rate limit check

I checked examples to find "rate limit check".
I only find one example in examples/friends.php

But it checkes rate limit after a "1/friends/ids" request.
Is it not better to check rate limit before making a request.

Thank you

Upload with Url

Is there a way to upload a photo with a url that is not on the local hardrive? For example facebook.com/favicon.ico <-- It is a url that is web accessible.

Failed to validate oauth signature and token

Hi Matt,

I've been playing with your library and for some reason I got stuck when attempting to authenticate. I can actually do a status update and I can even get a list of friends but unfortunately I cannot seem to be able to get a request_token. I keep getting a 401 Unauthorized with "Failed to validate oauth signature and token".

This is what I'm trying to do. Pretty straight forward:

        $this->twitter = new tmhOAuth(array(
              'consumer_key'    => TWITTER_CONSUMER_KEY,
              'consumer_secret' => TWITTER_CONSUMER_SECRET,
              'user_token'      => TWITTER_ACCESS_TOKEN,
              'user_secret'     => TWITTER_ACCESS_SECRET,
              ));

        $params = array(
            'oauth_callback'     => tmhUtilities::php_self()
        );

        $this->twitter->request('POST', $this->twitter->url('oauth/request_token', ''), $params);

I've verified the credentials, it works, like I said I can post a tweet but I can't get a request token back. I've verified that the time is in sync with GMT and I've even tried your utility which tries to auto fix the time issue but I'm still getting the same error.

Any idea what's going on?

Thanks

Image background Issue

Hi,

I'm traing to upload a background, im using the example 'images.php', but the system always return error 403 with this message:

" There was a problem with your background image. Probably too big."

I upload images of small sizes 15kb but either work.

could someone explain me what im doing wrong? or if curl need some extra configuration to work.

Streaming api with follow is not working?

I am using track keyword with streaming.php...
It works fine. It tracks the tweets.
But i am just using follow param it shows empty string as tweet.
What is the issue here?

small improvement

Hi, nice work with this library, very easy to use and works as you could expect. Nevertheless, I propose to you a very small change to make the usage of the code more compact.

first: at the line 350: CHANGE to: return $this->curlit($multipart);
second: function curlit, make it "return $code" at the end.

With this change you could process in the same "if" the return code of the request you just made, making it more compact and even more readable (IMO).

Thanks for share this class.

Warnings from IDE

I use phpStorm IDE.
And it gives many warnings in my code. Most of them because of response and request
Can you recommend me a way to discard tmhOAuth based warnings?

$code=$tmhOAuth->request('GET', $tmhOAuth->url('1/account/totals') );
Warning: 'void' method 'request' result used

$responseData = json_decode($tmhOAuth->response['response'],true);
Field 'response' not found in class tmhOAuth

stdClass member warnings

I'm sorry this issue is not directly with tmhOAuth but maybe you can help me.
I use _phpStorm_ as IDE. It gives warnings for _stdClass_ responses.

For example

    $tmhOAuth = new tmhOAuth(array(
        'consumer_key'    => YOUR_CONSUMER_KEY_SAM,
        'consumer_secret' => YOUR_CONSUMER_SECRET_SAM,
        'user_token'      => $atoken1,
        'user_secret'     => $atoken2,
    ));

    $code=$tmhOAuth->request('GET', $tmhOAuth->url('1/followers/ids') );

    if ($code == 200) {
        $responseData = json_decode($tmhOAuth->response['response'],true);
}

IDE gives warning for $tmhOAuth->response['response']
The warning is Field 'response' not found in class tmhOAuth

It supposes that response is a function.
Should i add some lines to declare it as stdClass, if so how can i do without breaking the functionality ?
I have so many requestes in my code, so warnings became huge..
Thank you in advance.

Failed to validate oauth signature and token

im getting this on oAuth, examples/auth.php

heres my varDump
object(tmhOAuth)#1 (5) {
["params"]=>
array(0) {
}
["headers"]=>
array(0) {
}
["auto_fixed_time"]=>
bool(false)
["buffer"]=>
NULL
["config"]=>
array(28) {
["user_agent"]=>
string(56) "tmhOAuth 0.621+SSL - //github.com/themattharris/tmhOAuth"
["use_ssl"]=>
bool(true)
["host"]=>
string(15) "api.twitter.com"
["consumer_key"]=>
string(21) "_"
["consumer_secret"]=>
string(41) "_
_"
["user_token"]=>
string(50) "_
"
["user_secret"]=>
string(42) "**
******"
["force_nonce"]=>
bool(false)
["nonce"]=>
bool(false)
["force_timestamp"]=>
bool(false)
["timestamp"]=>
bool(false)
["oauth_version"]=>
string(3) "1.0"
["oauth_signature_method"]=>
string(9) "HMAC-SHA1"
["curl_connecttimeout"]=>
int(30)
["curl_timeout"]=>
int(10)
["curl_ssl_verifyhost"]=>
int(2)
["curl_ssl_verifypeer"]=>
bool(true)
["curl_cainfo"]=>
string(85) "/var/www/myDomain/twitter/tmhOAuth-d0b0bc6/cacert.pem"
["curl_capath"]=>
string(74) "/var/www/myDomain/twitter/tmhOAuth-d0b0bc6"
["curl_followlocation"]=>
bool(false)
["curl_proxy"]=>
bool(false)
["curl_proxyuserpwd"]=>
bool(false)
["curl_encoding"]=>
string(0) ""
["is_streaming"]=>
bool(false)
["streaming_eol"]=>
string(2) "
"
["streaming_metrics_interval"]=>
int(60)
["as_header"]=>
bool(true)
["debug"]=>
bool(false)
}
}

Urgent !!! Issues with photo_tweet.php

Hello,

When i try to upload a photo using photo_tweet.php i get no response from twitter and

$code = 0

after requesting a var_dump($code) .

It does not even tells me what the error is .

Please this is an urgent issue can you please help me ?

Implode in tmhOAuth::create_nonce()

  $this->config['nonce'] = md5(substr($prefix . implode($sequence), 0, $length));

Can you add the $glue parameter so it is more consistent with the more usual "string implode ( string $glue , array $pieces )"

Thanks!

Character encoding in status

I cant make it work with special characters as á é í ñ ,etc.

A while ago with another library i fixed by doing utf8_encode() to the status message but here its just removing the characters. Any clues?

Can't post pictures from web (with a URI)

Thanks Matt, this library works just fine.

There I met an issue though. When trying to post an image file from the web using its URI, and put the URI into one of the elements for the request array parameter, like this:

$img = 'http://distilleryimage11.s3.amazonaws.com/d8f7dc28825b11e180d51231380fcd7e_7.jpg';

$code = $tmhOAuth->request('POST', 'https://upload.twitter.com/1/statuses/update_with_media.json',
  array(
    'media[]'  => "@$img",
    'status'   => "Test uploading.".time() // Don't give up..
  ),
  true, // use auth
  true  // multipart
);

And var_dump() the tmhOAuth's response, there it says:

["error"]=>
  string(102) "couldn't open file "http://distilleryimage11.s3.amazonaws.com/d8f7dc28825b11e180d51231380fcd7e_7.jpg"
"
["errno"]=>
  int(26)

and of course the picture wasn't posted to my twitter timeline. But with a local image file it works fine, like "./picture.jpg".
Now what I'm doing is file_put_contents() the image from web to my local storage, then post the stored file.
Please have a look at this. Thank you!

Cannot update geo

$connection->url('1/statuses/update'), array("status" => $tweet_text, "lat" => $lat, "long" => $long, "display_coordinates" => 'true'));

Status is updated lat and long silently fail.

With Net-Twitter (Perl) this works
my $result = $nt->update({status => $tweet_text, lat=> $lat, long=>$long});

oauth_verifier isnt't sent in Authorization header (access token phase)

Hello, I'm using your library to test out my oAuth 1.0a provider I wrote, during the exchange between a request token and an access token (after the user authorized the application), my server doesn't receive the "oauth_verifier" in the Authorization header. It seems that this parameter ain't merged into auth_params.

Is there something I'm missing? Thanks

Fetching profile image

I'm trying to get profile image. I couldn't find an example in library.
So i used this code:
$params = array( 'screen_name' => $scrName );
$code = $tmhOAuth->request('GET', $tmhOAuth->url('1/users/profile_image') , $params);

But the output is as follows:
< html > < body >You are being redirected.< /body >< /html >

Is it possible to fetch image link by tmhOAuth library?

issue with update_with_media method.

Hi,

I'm trying to update a status with a picture. But I keep getting stuck at error 26. I'm using this in a drupal7 local environment.
Here is the function:

function moxies_twitter_updates_status_with_media($tweet,$user,$replyID=NULL,$media){
require 'tmhOAuth/tmhOAuth.php';
require 'tmhOAuth/tmhUtilities.php';

$tmhOAuth = new tmhOAuth(array(
  'consumer_key'    => CONSUMER_KEY,
  'consumer_secret' => CONSUMER_SECRET,
  'user_token'      => moxies_twitter_get_oauth_token($user), 
  'user_secret'     => moxies_twitter_get_auth_token_secret($user),
    'host'          => "upload.twitter.com"
));
// connection is good!

$image = image_style_url('large', $media->uri);  // http://staging.simplesimple.ca:8081/phase2/sites/default/files/styles/large/public/lips_2.jpg
$mime = $media->filemime; // image/jpeg
$result = $tmhOAuth->request(
  'POST',
   'https://upload.twitter.com/1/statuses/update_with_media.json',
  array(
    'media[]'  => "@{$image}",
    'status'   => 'Picture time',
  ),
  true, // use auth
  true  // multipart
);

if ($result == 200) {
  tmhUtilities::pr(json_decode($tmhOAuth->response['response']));
} else {
  tmhUtilities::pr($tmhOAuth->response['response']);
}

dsm($tmhOAuth->response); // Forcing the output of the response through Drupal messaging because the tmhUtilities are not outputting anything :/

}

Once this runs, this is my response:

Array
(
[code] => 0
[response] =>
[info] => Array
(
[url] => https://upload.twitter.com/1/statuses/update_with_media.json
[content_type] =>
[http_code] => 0
[header_size] => 0
[request_size] => 0
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 0.343
[namelookup_time] => 0.031
[connect_time] => 0.093
[pretransfer_time] => 0.343
[size_upload] => 0
[size_download] => 0
[speed_download] => 0
[speed_upload] => 0
[download_content_length] => -1
[upload_content_length] => -1
[starttransfer_time] => 0
[redirect_time] => 0
[certinfo] => Array
(
)

        [redirect_url] => 
    )

[error] => couldn't open file "/signature-johan.gif"

[errno] => 26

)

I've tried with different types of filetypes and I keep getting this same error. Am I missing something really simple here?

Example with user auth

Hi, thanks for the great library first of all.

I need to implement tmhOAuth but I need user oauth_token/secret because the tweet has to belong to the user but I don't know where to put the hands :) Could you show an example? Thanks in advance.

Kill trailing ?>

They're not needed unless you're stopping the PHP block, and dependant on usage, they can cause stupid header already sent errors in PHP

Would you mind removing them from both tmhOAuth.php and tmhUtilities.php?

Saves having to remember to remove them when pulling them in upstream...

Thanks!

Change Profile Picture Failed at images.php

i want to change my avatar but result from twitter like this

{"request":"/1/account/update_profile_image.json","error":"Invalid Unicode value in one or more parameters"}

some body can resolve this issue?

twitpic by oauth_echo.php

I tried to post a image to twitpic by oauth_echo.php. but it returned the error.
After I changed this code from "true" to "false" and "false" to "true", I could it.
I don't know that this is the bug or not. so please give advise to me.

function generate_verify_header($tmhOAuth) {
// generate the verify crendentials header -- BUT DON'T SEND
// note the https URL change - this is due to posterous requiring https in the X-Auth-Service-Provider
$tmhOAuth->config['prevent_request'] = true; --> false
$tmhOAuth->request('GET', $tmhOAuth->url('1/account/verify_credentials'));
$tmhOAuth->config['prevent_request'] = false; -->true
}

There was an error communicating with the delegator

Hi, i need some help i am using the latest version of the lib package, i am currently trying to post an image via twitpic with no success.

I am using the file: oauth_echo_twitpic.php,
my twitpic app key,
my twitter: consumer_key, consumer_secret, oauth_token and oauth_token _secret
a local file called 'welcome.png', in the same directory as oauth_echo_twitpic.php

and i get this error everytime: 'There was an error communicating with the delegator'

below print the result of the browser dump:

---------------------------------------------------------------- oauth_echo_twitpic.php output ------------------------------------------------------

There was an error communicating with the delegator
tmhOAuth Object
(
[params] => Array
(
)

[headers] => Array
    (
        [X-Auth-Service-Provider] => https://api.twitter.com/1/account/verify_credentials.json
        [X-Verify-Credentials-Authorization] => OAuth oauth_consumer_key="****[removed]****", oauth_nonce="****[removed]****", oauth_signature="****[removed]****", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1328045719", oauth_token="****[removed]****", oauth_version="1.0"
        [Expect] => 
    )

[auto_fixed_time] => 
[buffer] => 
[config] => Array
    (
        [user_agent] => tmhOAuth 0.61+SSL - //github.com/themattharris/tmhOAuth
        [use_ssl] => 1
        [host] => api.twitter.com
        [consumer_key] => ****[removed]****
        [consumer_secret] => ****[removed]****
        [user_token] => ****[removed]****
        [user_secret] => ****[removed]****
        [force_nonce] => 
        [nonce] => dbccb6ca52b9ae2549b19a67a4cd373e
        [force_timestamp] => 
        [timestamp] => 1328045719
        [oauth_version] => 1.0
        [oauth_signature_method] => HMAC-SHA1
        [curl_connecttimeout] => 30
        [curl_timeout] => 10
        [curl_ssl_verifyhost] => 2
        [curl_ssl_verifypeer] => 1
        [curl_cainfo] => /home/****[removed]****/public_html/cacert.pem
        [curl_capath] => /home/****[removed]****/public_html
        [curl_followlocation] => 
        [curl_proxy] => 
        [curl_proxyuserpwd] => 
        [curl_encoding] => 
        [is_streaming] => 
        [streaming_eol] => 

        [streaming_metrics_interval] => 60
        [as_header] => 1
        [debug] => 
        [prevent_request] => 
        [multipart] => 1
    )

[method] => POST
[url] => http://api.twitpic.com/2/upload.json
[signing_params] => oauth_consumer_key=****[removed]****&oauth_nonce=dbccb6ca52b9ae2549b19a67a4cd373e&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1328045719&oauth_token=****[removed]****&oauth_version=1.0
[auth_params] => Array
    (
        [oauth_version] => 1.0
        [oauth_nonce] => dbccb6ca52b9ae2549b19a67a4cd373e
        [oauth_timestamp] => 1328045719
        [oauth_consumer_key] => ****[removed]****
        [oauth_signature_method] => HMAC-SHA1
        [oauth_token] => ****[removed]****
    )

[request_params] => Array
    (
        [key] => 
        [media] => @welcome.png;type=image/png;filename=welcome.png
        [message] => trying something out
    )

[base_string] => GET&https%3A%2F%2Fapi.twitter.com%2F1%2Faccount%2Fverify_credentials.json&oauth_consumer_key%3D****[removed]****%26oauth_nonce%3D9a25880c57a48c96eafb9a464adefd6e%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1328045719%26oauth_token%3D****[removed]****%26oauth_version%3D1.0
[signing_key] => ****[removed]****
[auth_header] => OAuth oauth_consumer_key="****[removed]****", oauth_nonce="9a25880c57a48c96eafb9a464adefd6e", oauth_signature="CvjlwkQqosyWIYYwx61FxK3X7Jg%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1328045719", oauth_token="****[removed]****", oauth_version="1.0"
[response] => Array
    (
        [headers] => Array
            (
                [server] => nginx
                [date] => Tue, 31 Jan 2012 21:35:19 GMT
                [content_type] => application/json
                [transfer_encoding] => chunked
                [connection] => keep-alive
                [x_powered_by] => PHP/5.3.5-1ubuntu7.2
            )

        [code] => 401
        [response] => {"errors":[{"code":401,"message":"Could not authenticate you (invalid application key)."}]}
        [info] => Array
            (
                [url] => http://api.twitpic.com/2/upload.json
                [content_type] => application/json
                [http_code] => 401
                [header_size] => 201
                [request_size] => 699
                [filetime] => -1
                [ssl_verify_result] => 0
                [redirect_count] => 0
                [total_time] => 0.203001
                [namelookup_time] => 0.002518
                [connect_time] => 0.038636
                [pretransfer_time] => 0.038655
                [size_upload] => 21604
                [size_download] => 91
                [speed_download] => 448
                [speed_upload] => 106423
                [download_content_length] => -1
                [upload_content_length] => 21604
                [starttransfer_time] => 0.038922
                [redirect_time] => 0
                [request_header] => POST /2/upload.json HTTP/1.1

User-Agent: tmhOAuth 0.61+SSL - //github.com/themattharris/tmhOAuth
Host: api.twitpic.com
Accept: /
Accept-Encoding: deflate, gzip
X-Auth-Service-Provider: https://api.twitter.com/1/account/verify_credentials.json
X-Verify-Credentials-Authorization: OAuth oauth_consumer_key="_[removed]__", oauth_nonce="9a25880c57a48c96eafb9a464adefd6e", oauth_signature="CvjlwkQqosyWIYYwx61FxK3X7Jg%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1328045719", oauth_token="__[removed]*_*", oauth_version="1.0"
Content-Length: 21604
Content-Type: multipart/form-data; boundary=----------------------------aac5284784ae

            )

        [error] => 
        [errno] => 0
    )

)

ERROR: You must enter a query

Hi Matt.

Im trying to program a simple retwitter bot (basically).

I started making it with twitterOAuth library, and then changed to yours because its capable of more things. The error i got this time is in search( ); function, while trying to perform any search, 'pages' value is not correctly set (I think). This is what var_dump($_POST) and vardump($args) say:

array(6) { ["search"]=> string(25) "#LlamadmeRebeldeSiQuereis" ["selection"]=> string(15) "rt_with_mention" ["string"]=> string(13) "@manualpuente" ["ckey"]=> string(0) "" ["csec"]=> string(0) "" ["ammount"]=> string(1) "5" } array(5) { ["q"]=> string(25) "#LlamadmeRebeldeSiQuereis" ["since_id"]=> string(1) "0" ["pages"]=> string(1) "1" ["rpp"]=> string(1) "5" ["lang"]=> string(2) "es" }

LlamadmeRebeldeSiQuereis: 0: 1: 5: es: array(1) { ["page"]=> int(1) } Received page 0 http://search.twitter.com/search.json?page=1 There was an error. string(55) "{"error":"You must enter a query."}"

So arg['$pages'] should be a string. I found issue #17 and fixed its value to $pages = '0', but no result (same error). Here is the full code (functions are examples of yours).

CODE: http://pastebin.com/H58cRHVa

How to set encoding/charset ?

Hi,

All accented characters are "destroyed" when requesting from/sending to Twitter.
Is there any solution to set the encoding to UT8, for example ?

Thanks for your big work, anyway :)

Regards

Callback address

Can we set oauth's callback address by using "oauth_callback"?

I read "Desktop applications only support the oauth_callback value"
But "POST oauth/request_token" says "oauth_callback required"

So if we set "oauth_callback", does this suppresses the callback address in application's settings value?
Did i miss something can you give more information?

Thank you

Using multipart to upload a photo with an @reply does not work.

For example, the following code is unsuccessful:

$response = $tmhOAuth->request(
      'POST',
      'https://upload.twitter.com/1/statuses/update_with_media.json',
      array(
          'media[]'  => '@' . $file,
          'status'   => '@example this is a great picture!',
      ),
      true, // use auth
      true  // multipart

);

Obviously this is due to PHP's interpretation of the @ symbol at the beginning of the status field signifying a filepath. It would be great to get support for this within the library.

Re-tweets retrieval

I want to implement in my Twitter app a functionality where a logged in user can see a list of user who has re-tweeted any of the tweets made from the logged in user, is there an API to do this? there is one and it retrieves the re-tweets of a given status id but not on the user id.

Thanks in advance for any help

Declaring functions as static

Can you declare functions as static methods? Because most of the methods are called statically..

Else i will put "error_reporting(E_ALL ^ E_STRICT);" in code.

Or do you suppress STRICT warnings?

Support request: 404 error after retweet action

I can successfuly post statuses but I'm stuck with retweet.

I'm trying to retweet a tweet by using Twitter API and tmhOauth with following snippet:

$tmhOAuth = new tmhOAuth(array( 'consumer_key' => YOUR_CONSUMER_KEY, 'consumer_secret' => YOUR_CONSUMER_SECRET, 'user_token' => $atoken1, 'user_secret' => $atoken2, )); $code = $tmhOAuth->request('POST', $tmhOAuth->url('1/statuses/retweet'), array('id' => '223136515088318466' ));
But this code gives following error:

[errors] => Array ( [0] => Array ( [message] => Sorry, that page does not exist [code] => 34 ) )

But I can see that status exists: https://twitter.com/Sekban_iCemil/status/223136515088318466

I'm pretty sure that consumer key and secret is correct, and user token and secret is authorized by user.

What do I miss ?

Getting User Info & Limit

Hi Matt,

Thanks for the library - well done! So far it's been pretty smooth sailing - I can successfully, for example, authenticate and get the user's favorite tweets. But I'm stuck on a couple of points:

  1. When I try to get the request limit I get the ip limit instead of the user limit. I'm using the following code (with a real username, but I also tried it without the username b/c the docs say you don't have to pass it - same result either way - I get the ip limit:
$tmhOAuth = new tmhOAuth(array(
    'consumer_key'    => $c_key,
    'consumer_secret' => $c_secret,
    'user_token'      => $token,
    'user_secret'     => $secret,
));

$url = "https://api.twitter.com/1/account/rate_limit_status/[USERNAME].json";

$tmhOAuth->request("GET", $url);

if ($tmhOAuth->response['code'] == 200) {
  $data = json_decode($tmhOAuth->response['response'], true);
} else {
  $data = htmlentities($tmhOAuth->response['response']);
  echo 'There was an error.' . PHP_EOL;
}
var_dump($data);

I can tell it's the ip limit because the max int in the response is 150. What am I missing here?

  1. What is the proper/best way to get the current authenticated user's basic info (username, id, etc) using the library? When I make a request to:

https://api.twitter.com/1/account/verify_credentials.json

OR

https://api.twitter.com/1/account/verify_credentials/[USERNAME].json

... using the same code that I've been using for favorites and request limit, I get "Could not authenticate with OAuth". And when I replace $url with $tmhOAuth->url('1/account/verify_credentials') I get an "expired token" error, which doesn't make sense to me because I can use the same token to get a list of favorite tweets 10 seconds later.

I hope I'm not missing something really simple, but it's entirely possible - my brain is so fried.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.