I created my Twitter App using PHP, but I don't know how to add parameters in Twitter API, my code:
$twitter_url = 'https://api.twitter.com/1.1/users/show.json'; // do not change it!
$data = array('oauth_consumer_key' => $consumer_key,
'oauth_nonce' => time(),
'oauth_signature_method' => 'HMAC-SHA1',
'oauth_timestamp' => time(),
'oauth_token' => '492687736-xxxxxxxx',
'oauth_version' => '1.0');
$baseString = buildBaseString($twitter_url, $data);
$compositeKey = $consumer_secret."&xxxxxxxx";
oauth_signature = base64_encode(hash_hmac('sha1', $baseString, $compositeKey, true));
$data['oauth_signature'] = $oauth_signature;
$response = sendRequest($data, $twitter_url);
$json = json_decode($response, true);
print_r($json);
My code is working good with "statuses/user_timeline" (without parameters) and I got my timeline, but when using "users/show" (without parameters) I got this message:
Array ( [errors] => Array ( [0] => Array ( [code] => 50 [message] => User not found. ) ) )
And when when using parameters like this:
$twitter_url = 'https://api.twitter.com/1.1/users/show.json?screen_name=jack';
I got this message:
Array ( [errors] => Array ( [0] => Array ( [code] => 32 [message] => Could not authenticate you. ) ) )
Now I want to know how to add parameters in my code?
I don't want any Twitter PHP library.