themattharris / tmhoauth-examples Goto Github PK
View Code? Open in Web Editor NEWExample uses of tmhOAuth
Example uses of tmhOAuth
Hello, I have severals Lists in my Twitters account and I need to access the
tweets, for each one.
Is there a way to sent the List name or Id by parameter ??
Hi there,
thanks for the examples and the great oauth library!
I needed the user_timeline with oAuth and Api 1.1, entities.php works great for that.
minor typo/bug in entities.php:
building the permalink in line 60 lacks in line 71 the string status
instead:
'<a href="https://twitter.com/%screen_name%/%id%">%created_at%</a>'
it should be:
'<a href="https://twitter.com/%screen_name%/status/%id%">%created_at%</a>'
for the granular addressibility of contents sake ; )
https://github.com/maybegeek/tmhOAuth-examples/commit/85ae314b4c9e7d1c9efe27a31f69738f6ea825a5
thanks again
christoph
Hi, Nice to meet you.
I excuted some examples.
But, Korean(language) in returned page was cracked.
I mean It does not show Korean. but it show English.
How do I fix this?
Why I am facing this problem?
I am using this code
require dirname(dirname(FILE)) . "/includes/tmhOAuth.php";
require dirname(dirname(FILE)) . "/includes/tmhUtilities.php";
$method = 'https://stream.twitter.com/1.1/statuses/filter.json';
// show Tweets which contan the word twitter OR have been geo-tagged within
// the bounding box -122.41,37.77,-122.40,37.78 OR are by themattharris
$params = array(
// matches tweets containing 'twitter' 'Twitter' '#Twitter'
'track' => 'twitter',
// matches tweets containing 'twitter' or 'love' (no spaces!)
//'track' => 'twitter,love'
// matches tweets containing 'twitter' and 'love'
//'track' =>'twitter love'
// Warning on extra spaces - below matches 'twitter' but not 'love'!
//'track' =>'twitter, love'
// Around Twitter HQ. First param is the SW corner of the bounding box
//'locations' => '-122.41,37.77,-122.40,37.78',
//'follow' => '777925' // themattharris
);
$tmhOAuth->streaming_request('POST', $method, $params, 'my_streaming_callback');
// output any response we get back AFTER the Stream has stopped -- or it errors
tmhUtilities::pr($tmhOAuth);
With all files and the simple code from the example tweet.php, I've this message :
Fatal error: Call to undefined function curl_init() in mhOAuth.php on line 589
Is it my fault, or something that you can fix ?
I think you are already now about this minor problem, but I decided to report it.
Method tmhOAuth::url returns wrong url for API method 'statuses/update_with_media':
https://api.twitter.com/1/statuses/update_with_media.json
but referring to documentation it must be following:
https://upload.twitter.com/1/statuses/update_with_media.json
I have searched the entire internet for working examples/tutorials or solutions to upload images with statuses to twitter and none really works actually, done countless test and tried almost all libraries suggested in PHP, yours seems to be the best and working but ONLY from command line, what about if you are building a social web app that needs to upload images with statuses, that's actualy part of what am doing...please help if you can!!!
Hi Matt,
I'm using your search example from the commandline for debugging purposes, it also gives the same result on the build i made, which receives params from a form.
I filled the data not set by default, but always says 0 results. What's wrong?
For last, I noticed that the libs probably where outdated, so i donwloaded the latest ones. Same error.
Please help.
Tried modifying the search.php to fit the new Search mechanism in 1.1, but not able to get it working with the new endpoint.
I'm trying to upload an image and status to Twitter, but the response I get back is 417 and nothing gets posted.
My code is this
$args['status'] = $status;
$args['media[]'] = '@'.$_FILES['image']['tmp_name'].';type='.$_FILES['image']['type'].';filename='.$_FILES['image']['name'];
$code = $tmhOAuth->request('POST', 'https://upload.twitter.com/1/statuses/update_with_media.json', $args,false,true);
I've seen some other issues like this (like this one http://www.lampdocs.com/blog/2011/06/twitter-error-417-expectation-failed-php-solution/) but I can't seem to get around it.
Any ideas?
Hi Matt, thanks for the reply regarding the question below. The code for this example would be greatly appreciated. Thanks again.
Original Q: 'I'm using the simple form for users to upload their own photos/images instead of the fixed photo/image option. Is it possible to add text area/input box for the user to add their own text with the photo/image (instead of the fixed 'Picture Time' comment)?'
When I run the 'friends.php' example script the browser freezes like when playing with infinite loops. The authentication seems to work since I am able to post tweets and print the array of all my userdata.
Any help/a solution would be great! Thanx!
https://github.com/themattharris/tmhOAuth-examples/blob/master/friends.php
why if execute the code in this way:
$a='code1';
$connection = new tmhOAuth(array(
'consumer_key' => $a,
'consumer_secret' => 'code2',
'user_token' => 'code3',
'user_secret' => 'code4,
));
i receive the 403 error ?
With the same auth code in your suggest way ( 'consumer_key' => 'code1' , ) everything works (err code 200!)
Can't I insert my auth code into 4 single variable and attached it into the array? I have to manage different twitter account in one single script and i need the array won't be fixed.
Reguards.
Twitter rejects if Expect 100-continue is set when doing the post request of uploading the photo.
By simply adding array("Expect" => "") to the headers fixes the issue.
example https://github.com/themattharris/tmhOAuth-examples/blob/master/photo_tweet.php
On line 52. Add extra parameter array("Expect" => "");
I'm having a few issues getting these examples to work with the new v1.1 API. Some endpoints have been removed completely so some of the examples no longer work.
The help/test endpoint which before in v1.0 was https://api.twitter.com/1/help/test.json no longer exists in v1.1. So this means the very useful example verify_ssl.php no longer works. Could you perhaps create a new branch or folder for a new set of v1.1 examples?
Many thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.