Howto access the UK Rackspace Cloud with the PHP Binding

One of the last library I didn’t documented in my earlier post was php-cloudfiles. You need to have at least the version 1.7.6 released to have support to different auth_server and when you have that you can do it like this to get access to cloud files via the library :

< ?php
require_once("cloudfiles.php");

# Allow override by environment variable
$USER = "MY_API_USERNAME";
$API_KEY = "MY_API_KEY";

$auth = new CF_Authentication($USER, $API_KEY, NULL, UK_AUTHURL);
$auth->authenticate();
?>

2 thoughts on “Howto access the UK Rackspace Cloud with the PHP Binding”

  1. You seem fairly handy when it comes to this stuff… any idea why the following code

    $auth = new CF_Authentication(USERNAME, API_KEY, NULL, UK_AUTHURL);

    is giving me

    PHP Fatal error: Uncaught exception ‘InvalidResponseException’ with message ‘Unexpected response (): ‘ in /var/www/sites/mysite/http/inc/rackspace/cloudfiles.php:212
    Stack trace:
    #0 /var/www/sites/mysite/http//test-rackspace.html(17): CF_Authentication->authenticate()
    #1 {main}
    thrown in /var/www/sites/mysite/http/inc/rackspace/cloudfiles.php on line 212

    ?

    When I was doing

    $auth = new CF_Authentication(USERNAME, API_KEY);

    I was getting

    PHP Fatal error: Uncaught exception ‘AuthenticationException’ with message ‘Invalid username or access key.’ in /var/www/sites/mysite/http/inc/rackspace/cloudfiles.php:209
    Stack trace:
    #0 /var/www/sites/mysite/http/test-rackspace.html(17): CF_Authentication->authenticate()
    #1 {main}
    thrown in /var/www/sites/mysite/http/inc/rackspace/cloudfiles.php on line 209

    I’ve tried 1.7.9 / 1.7.8 / 1.7.6 versions of the code. None makes any difference.

    Any help massively appreciated, tearing my hair out here!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.