Jump to content

I need a help for cURL and tmhOAuth and twitter API

- - - - -

  • Please log in to reply
No replies to this topic

#1
Tadashi Kobayashi

Tadashi Kobayashi

    Newbie

  • Members
  • Pip
  • 1 posts
Hi.

Now, I'm trying to post a message and a picture to Twitter(api) with tmhOAuth whitch uses cURL.
But I faced a trouble that I cannot send a message when the message starts with @.
to say..
SUCCESS: John, how does it feel?
FAIL: @John, how does it feel?

I've read the source of 'tmhOAuth' to understand that tmhOAuth send the message to cURL as an argument.
Then, It is likely that cURL cannot treat strings whitch start with @ as an information to send in HTTP request (at least, as it is).

Please tell me a solution. help me.
Maybe there are useful optional settings for cURL, but I dont know.
and I don't know other method to update twitter's status with sending a picture except using tmhOAuth.


////

a use of tmhOAuth in my app

$tmhOAuth = new tmhOAuth(array(

			'consumer_key'    => $consumerKey,

			'consumer_secret' => $consumerSecret,

			'user_token'      => $user_oauth_token,

			'user_secret'     => $user_oauth_token_secret,

));

$str_tweet = "john, how does it feel?"; //SUCCESS

$str_tweet = "@john, how does it feel?"; //FAIL

$file = "./hoge.jpg";

$postParams = array(

			"status"=>$str_tweet,

			"media[]"=>"@".$file

			);

$code = $tmhOAuth->request('POST', 'https://upload.twitter.com/1/statuses/update_with_media.json',

				$postParams,

				true, // use auth

				true  // multipart

			);

//$code returns 0



a use of cURL in tmhOAuth.php

curl_setopt($c, CURLOPT_POSTFIELDS, $this->request_params); //$this->request_params equal to $postParams



my environment is..
centOS5.6
PHP 5.3.8
curl 7.15.5




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users