Im trying to return values from a remote API using curl within PHP, but the form refuses to save, instead rendering a 404 every time, so im unable to even test this. Any ideas on the issue? is it the includes line? if so, how to include oAuth.php?
( please note that the code functions well on its own page)
Also do form variables need {bID} curly braces?
Thanks in advance
( please note that the code functions well on its own page)
Also do form variables need {bID} curly braces?
<?php
require("OAuth.php");
// redacted from live page
//$bID=$_POST['bID'];
//$oNo=$_GET['oNo'];
$consumer_key = "xxx";
$shared_secret = "xxx";
$url = "somedamnsite";
$args = array();
$args["bID"]=$bID; // <-- variable from form
$args["orderNo"]=$oNo; // <-- variable from form
$consumer = new OAuthConsumer($consumer_key, $shared_secret);
$request = OAuthRequest::from_consumer_and_token($consumer, NULL,"POST", $url, $args);
$request->sign_request(new OAuthSignatureMethod_HMAC_SHA1(), $consumer, NULL);
$url = sprintf("%s?%s", $url, OAuthUtil::build_http_query($args));
// print_r($request);
$ch = curl_init();
$headers = array($request->to_header());
// print_r($headers);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$rsp = curl_exec($ch);
$results = json_decode($rsp);
print_r($results);
?>
Thanks in advance