Created
April 11, 2012 12:10
-
-
Save miholeus/2358976 to your computer and use it in GitHub Desktop.
remote file download
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(!empty($remote)) { | |
$config = array( | |
'adapter' => 'Zend_Http_Client_Adapter_Curl', | |
'curloptions' => array( | |
CURLOPT_RETURNTRANSFER => 1, | |
CURLOPT_HEADER => 0, | |
CURLOPT_CONNECTTIMEOUT => 5, | |
), | |
); | |
$client = new \Zend_Http_Client($remote, $config); | |
try { | |
$client->request(); | |
} catch (\Exception $e) { | |
throw new ProductsService\RemoteFileException($e->getMessage()); | |
} | |
$response = $client->getLastResponse(); | |
$contentType = $response->getHeader('Content-type'); | |
$contentBody = $response->getRawBody(); | |
var_dump($contentType); | |
var_dump($contentBody); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment