#!/usr/bin/php <?php // NOTE - You must have special access to use this endoint. To request access, please submit the form here - https://www.shapeways.com/contact/contact-form?email_to=service%2Bbizdev@shapeways.com require "consumer_key.php"; require "access_token.php"; require "api_url_base.php"; require "error.php"; try { $oauth = new Oauth($consumer_key, $consumer_secret, OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_AUTHORIZATION); $oauth->enableDebug(); $oauth->setToken($access_token, $access_secret); } catch (OAuthException $E) { Error("setup exception", $E->getMessage(), null, null, $E->debugInfo); } try { $orderId = 12345; // CHANGEME $data = array("orderId" => $orderId); $data_string = json_encode($data); $oauth->fetch($api_url_base . "/orders/{$orderId}/v1", null, OAUTH_HTTP_METHOD_GET, array("Accept" => "application/json")); $response = $oauth->getLastResponse(); $json = json_decode($response); if (null == $json) { PrintJsonLastError(); var_dump($response); } else { print_r($json); } } catch (OAuthException $E) { Error("fetch exception", $E->getMessage(), null, $oauth->getLastResponseInfo(), $E->debugInfo); }
<?php @(require_once 'config.inc.php'); $oauth_client = new Oauth(CLIENT_KEY, CLIENT_SECRET); $oauth_client->enableDebug(); echo "created oauth_client object"; try { $info = $oauth_client->getRequestToken("http://localhost/oauth/pages/oauthhandler.php?query=request_token&oauth_callback=http://localhost/oauth/client/callback.php"); print_r($info); echo "<br/><br/><br/><br/>"; echo "Request token has been obtained"; echo "Request token:" . $info['oauth_token']; echo "Request token secret:" . $info['oauth_token_secret']; echo "visit <a href='" . $info['auth_url'] . "&request_token=" . $info['request_token'] . "'>this page</a> to authenticate"; } catch (OAuthException $e) { print_r($e); }