PHP Post not working with twitter api
-
Im trying to use the following PHP to add a favorite to my account: <?php if(isset($_POST['submit'])) { $fav = $_REQUEST['fav']; $connection->post('favorites/create', array('id' => $fav)); echo "<div style='padding-bottom: 5px; color: #0099FF;'>Fav Created Successfully.</div>"; } ?> With the following form: <form id="fav" method='post' action='index.php'> <input type="text" style="width: 346px;" name="fav" id="fav" ></input> <input type="submit" value="Fav This!" name="submit" id="submit" /> </form> Its not creating a favorite, Can anyone spot anything wrong with it? PS: I am using the OAuth API: $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);
-
Answer:
If I'm not mistaken, you don't need to add an "id" parameter. Looking at http://dev.twitter.com/doc/post/favorites/create/%3aid the URL to create a favorite would be http://api.twitter.com/1/favorites/create/12345.xml where "12345" is the ID of the tweet.
CLiown at Stack Overflow Visit the source
Other answers
$response = $connection->post('favorites/create/'.$fav); The ID is not a parameter.
CLiown
When I tried it, it says the following. This method requires a GET. Although Twitter API documentation says it requires a POST. So, try to do a GET request on it: $response = $connection->get('favorites/create', array('id' => $fav)); // now print the response to see if any error pops up: print_r($response);
shamittomar
Im trying to use the following PHP to add a favorite to my account: $favorite = $connection->post('favorites/create/'.$id); where $id is the status id but favorite don't return nothing
alexandra
Related Q & A:
- How To Send Free Sms With Php Api?Best solution by Stack Overflow
- How to access the Twitter Streaming API from Python?Best solution by Stack Overflow
- How to reply to particular tweet using Twitter API?Best solution by Stack Overflow
- What is it like working at the US Post Office?Best solution by Yahoo! Answers
- Why are HTML and PHP forms not working?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.