Exemplo n.º 1
0
 private function __signed_post($url, $params)
 {
     $auth = om($this->consumer, $url, $params, $this->token);
     $curl = curl_init($url);
     $postbody = http_build_query($params);
     //curl_setopt($curl, CURLOPT_VERBOSE, TRUE);
     curl_setopt($curl, CURLOPT_POST, TRUE);
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
     curl_setopt($curl, CURLOPT_POSTFIELDS, $postbody);
     curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-type: application/x-www-form-urlencoded', 'Authorization: ' . $auth));
     $body = curl_exec($curl);
     curl_close($curl);
     return $body;
 }
Exemplo n.º 2
0
 private function __signed_post($url, $params, $isMultipart = FALSE)
 {
     if ($isMultipart) {
         // Don't include the parameters in the signature if multipart/form-data
         // http://tools.ietf.org/html/rfc5849#section-3.4.1.3.1
         $auth = om($this->consumer, $url, array(), $this->token);
         $postbody = $params;
     } else {
         $auth = om($this->consumer, $url, $params, $this->token);
         $postbody = http_build_query($params);
     }
     $curl = curl_init($url);
     // curl_setopt($curl, CURLOPT_VERBOSE, TRUE);
     curl_setopt($curl, CURLOPT_POST, TRUE);
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
     curl_setopt($curl, CURLOPT_POSTFIELDS, $postbody);
     curl_setopt($curl, CURLOPT_HTTPHEADER, array('Authorization: ' . $auth));
     $body = curl_exec($curl);
     curl_close($curl);
     return $body;
 }
Exemplo n.º 3
0
#!/usr/bin/php -q
<?php 
require '../php/om.php';
$consumer = array($argv[1], $argv[2]);
$url = $argv[3];
$params = array();
parse_str($argv[4], $params);
if ($argv[5] != '' && $argv[6] != '') {
    $token = array($argv[5], $argv[6]);
} else {
    $token = NULL;
}
$method = $argv[7];
if ($argv[8] != '') {
    $realm = $argv[8];
} else {
    $realm = NULL;
}
$timestamp = $argv[9];
$nonce = $argv[10];
print om($consumer, $url, $params, $token, $method, $realm, $timestamp, $nonce);