Basically working, now I need to resolve some jsontool wranglings

This commit is contained in:
Kai Hendry
2013-02-09 15:34:33 +08:00
parent a38709d76a
commit 4a13e5abc3
2 changed files with 16 additions and 22 deletions

View File

@@ -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);