I'm requesting a zip file from a remote location, and I'm getting some strange affects here. Here is a snippet:
$result = drupal_http_request($serviceUrl, $options); $file = $result->data; dpm($result, 'file result'); //returns the object, and I can see $result->data is a string of characters dpm($result->data, 'data'); //But, this is empty dpm($file, 'file'); //This is also empty dpm($result, 'file result'); // Still shows me the object with $result->data
The http request works fine as it returns with a code 200
I want to use it as follows (example):
temp_filename = "my_zip.zip"; $zip_file = fopen($temp_filename, "w+"); fwrite($zip_file, $file); //$file is $result->data, but is empty. fclose($zip_file);
Anybody got an idea why I can't get $result->data?
The code is inside an object method, not a standard PHP function. Not sure if that has anything to do with it.
Also worth mentioning that I can read $result->code and $result->status_message with no problems.