/** * This function is used to make a HTTP PUT (POST) call to rackspace cloud service. * internally used by all objects in this package. This function makes use of a * authenticated RackAuth object. * * HACKED BY NICK B * * @param string $Url (key part of the API access point) * @param RackAuth $RackAuth Authenticated RackAuth object * @return unknown */ public function postAuthenticatedPutRequest($Url, RackAuth $RackAuth, $PostData = null) { $PostUrl = $RackAuth->getXServerManagementUrl() . "/" . $Url; $AuthToken = $RackAuth->getXAuthToken(); //echo $AuthToken; $Response = self::post($PostUrl, array("X-Auth-Token" => $AuthToken, "Content-Type" => "application/json"), $PostData, false, false, true); return $Response; }
<?php include_once 'lib/functions.php'; $cookieValue = checkCookieExists("info"); $cookieValue = getCookieData($cookieValue); $userName = $cookieValue['userName']; $authKey = $cookieValue['authKey']; $software = $cookieValue['software']; $auth = new RackAuth($userName, $authKey); @$auth->auth(); $lastHTTPCode = Request::getLastHTTPCode(); $lastErrorMessage = Request::getLastError(); if ($lastHTTPCode == 204) { $apiAuthInfo = array('XAuthToken' => $auth->getXAuthToken(), 'XStorageToken' => $auth->getXStorageToken(), 'XStorageUrl' => $auth->getXStorageUrl(), 'XServerManagementUrl' => $auth->getXServerManagementUrl(), 'XCDNManagementUrl' => $auth->getXCDNManagementUrl()); $cookieContent = makeCookie($apiAuthInfo); setMyCookie("apidetails", $cookieContent, 3600); } include 'header2.php'; ob_start(); if ($software == "magento") { print "<p>Since you have chosen Magento, you may want to choose a size larger than 4Gb.</p>"; } if ($debug) { echo "<p>HTTPCode: {$lastHTTPCode}<br>\nErrorMessage: {$lastErrorMessage}</p>\n"; } if ($lastHTTPCode == (401 | 403)) { print "There seems to be a problem with your authentication info. Please <a href=\"/\">try again</a>."; include 'footer2.php'; exit(1); } if ($lastHTTPCode == 413) {