Hi!

I'm trying to post a sample CCR Record to my H9 account. I can do this
via OAuth Playground. On my server (go.isidorey.net) I can't seem to
replicate the posting of the same document. There must be something
wrong because I'm not using AuthSub but this is returning in the
error. I've tried using RSA and HMAC (although I'm not sure which one
I need) to no avail.

Here's my authorization header:

authorization_header":"Authorization: OAuth oauth_version=\"1.0\",
oauth_nonce=\"cde565c2002fcb563191f66096ae1ca1\", oauth_timestamp=
\"1285798678\", oauth_consumer_key=\"go.isidorey.net\", oauth_token=
\"1%252FkgwbftfOEpBCDoYK9p-mqSLELFUNRO52pXYs9Itn7n8\",
oauth_signature_method=\"RSA-SHA1\", oauth_signature=\"\""}

My PHP:


    $feedUri = trim($feedUri);

    // create an associative array from each key/value url query param
pair.
    $params = array();
    $pieces = explode('?', $feedUri);
    if (isset($pieces[1])) {
     $params = explode_assoc('=', '&', $pieces[1]);
    }

    // urlencode each url parameter key/value pair
    $tempStr = $pieces[0];
    foreach ($params as $key=>$value) {
      $tempStr .= '&' . urlencode($key) . '=' . urlencode($value);
    }
    $feedUri = preg_replace('/&/', '?', $tempStr, 1);

    $req = OAuthRequest::from_consumer_and_token($consumer,
$oauth_token,
                                                 $http_method,
$feedUri, $params);


    $req->sign_request($sig_method, $consumer, $oauth_token,
$privKey);

    $auth_header = $req->to_header();

    // decide where to put the oauth_* params (Authorization header or
in URL)
    if ($_REQUEST['oauth_params_loc'] == 'query') {
      $feedUri = $req->to_url();
      $auth_header = null;
    }


    $content_type = "Content-Type: application/atom+xml";
    $gdataVersion = 'GData-Version: 2.0';


    $result = send_signed_request($http_method, $feedUri,
                                  array($auth_header, $content_type,
$gdataVersion), $postData);


    if (!$result) {
      die("{'html_link' : '" . $req->to_url() . "', " .
           "'base_string' : '" . $req->get_signature_base_string() .
"', " .
           "'response' : '" . $result . "'}");  // return json
    }

    echo "5";

    $result = split('<', $result, 2);

    // If response was not XML xml_pretty_printer() will throw
exception.
    // In that case, set the response body directly from the result
    try {
      $response_body = @xml_pretty_printer(isset($result[1]) ? '<' .
$result[1] : $result[0], true);
    } catch(Exception $e) {
      $response_body =  isset($result[1]) ? '<' . $result[1] :
$result[0];
    }

    // <pre> tags needed for IE
    $response_body = '<pre>' . $response_body . '</pre>';

    echo json_encode(array('html_link' => $req->to_url(),
                           'base_string' =>  $req-
>get_signature_base_string(),
                           'headers' => isset($result[1]) ?
$result[0] : '',
                           'response' => $response_body,
                           'authorization_header' => $auth_header));

Any advice would be much appreciated, thank you!

-- 
You received this message because you are subscribed to the Google Groups 
"Google Health Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/googlehealthdevelopers?hl=en.

Reply via email to