I'm building a web application that allows to upload many types of files, some of them very big. Backend is built using Symfony (v3.1 in fact, but I don't think this matters for the issue) and I am using Gaufrette Bundle to interact with the filesystem. I found it a great solution, since it allows me to easily switch between local storage and cloud object storage depending on the file type and size.
However, I don't manage to make it work with Softlayer Object Storage. It has many built in wrappers, one of them for OpenStack based clouds (e.g. Rackspace or Softlayer) and the documentation seems very comprehensive, but I can't successfully connect to Softlayer API.
I have tried both integration within the Symfony Bundle and using the libraries directly in my classes and none of them works, below the latter:
public function uploadFromUrl($url)
{
$connection = new OpenStack(
'https://fra02.objectstorage.softlayer.net/auth/v1.0/',
array(
'username' => 'myuser',
'password' => 'mykey'
)
);
dump($connection);
$objectStore = $connection->objectStoreService('cloudFiles', 'fra02', 'publicURL');
$adapter = new OpenCloudAdapter(
$objectStore,
'mycontainer'
);
$filesystem = new Filesystem($adapter);
$filename = pathinfo($url, PATHINFO_FILENAME);
$filesystem->write($filename, file_get_contents($url));
return $filename;
}
And the error I am getting:
Client error response
[status code] 400
[reason phrase] Bad Request
[url] https://fra02.objectstorage.softlayer.net/auth/v1.0/tokens
I suspect the problem is related to a bad formatting of the curl the library is doing internally, but I have no way to find out what are the parameters it is passing and whether they match with Softlayer API. I have tried both OpenStack and Rackspace examples shown in Gaufrette documentation with no luck