mirror of
https://github.com/thewesker/greptweet.git
synced 2025-12-22 13:01:06 -05:00
Basically working, now I need to resolve some jsontool wranglings
This commit is contained in:
14
oauth.php
14
oauth.php
@@ -1,6 +1,11 @@
|
||||
#!/usr/bin/php
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
if (empty($argv[1])) { exit(1); }
|
||||
|
||||
$urlargs = $argv[1];
|
||||
parse_str($urlargs, $merge_to_oauth);
|
||||
|
||||
function buildBaseString($baseURI, $method, $params) {
|
||||
$r = array();
|
||||
ksort($params);
|
||||
@@ -29,11 +34,10 @@ $oauth = array( 'oauth_consumer_key' => $consumer_key,
|
||||
'oauth_signature_method' => 'HMAC-SHA1',
|
||||
'oauth_token' => $oauth_access_token,
|
||||
'oauth_timestamp' => time(),
|
||||
'screen_name' => 'kaihendry',
|
||||
'count' => 200,
|
||||
'page' => $argv[1],
|
||||
'oauth_version' => '1.0');
|
||||
|
||||
$oauth = array_merge($oauth, $merge_to_oauth);
|
||||
|
||||
$base_info = buildBaseString($url, 'GET', $oauth);
|
||||
$composite_key = rawurlencode($consumer_secret) . '&' . rawurlencode($oauth_access_token_secret);
|
||||
$oauth_signature = base64_encode(hash_hmac('sha1', $base_info, $composite_key, true));
|
||||
@@ -44,7 +48,7 @@ $header = array(buildAuthorizationHeader($oauth), 'Expect:');
|
||||
$options = array( CURLOPT_HTTPHEADER => $header,
|
||||
//CURLOPT_POSTFIELDS => $postfields,
|
||||
CURLOPT_HEADER => false,
|
||||
CURLOPT_URL => $url . '?screen_name=kaihendry&count=200&page=' . $argv[1],
|
||||
CURLOPT_URL => $url . '?'. $urlargs,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_SSL_VERIFYPEER => false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user