I'm using the following CURL request to post a file to Rackspace Cloud Files:
$ch = curl_init(trim($rackspace['X-Storage-Url']).'/container/hello');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-Auth-Token: '.$rackspace['X-Auth-Token'], 'Content-Length: '.$data['file']['size']));
curl_setopt($ch, CURLOPT_PUT, true);
curl_setopt($ch, CURLOPT_INFILE, fopen($data['file']['path'], 'r'));
curl_setopt($ch, CURLOPT_INFILESIZE, $data['file']['size']);
curl_setopt($ch, CURLOPT_HEADER, true);
echo curl_exec($ch);
I'm following the Rackspace documentation, but I'm getting a 404 Not Found error and I'm not quite sure how to troubleshoot this. Any suggestions?
SOLUTION
After further analysis, I discovered that the X-Storage-Url that was issued after authenticating was https://storage101.dfw1.clouddrive.com. The dfw1 indicates the data center in Dallas, but the containers I created were in Chicago. To confirm that this was the problem, I created a container at the Dallas data center and tried again – everything worked fine. I submitted a ticket to Rackspace to have my default storage location changed to Chicago. Everything is working now.
As pointed out in the selected answer, if I had been using the most up-to-date version of the API (2.0), then I would have been presented with URLs for both locations.
401 Unauthorizederror, which is expected since theX-Auth-Tokenisn't set. - David Jones