2014-12-24 21:58:24 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Model\Proxy;
|
|
|
|
|
|
|
|
use Model\Config;
|
|
|
|
use PicoFeed\Client\Client;
|
|
|
|
use PicoFeed\Client\ClientException;
|
|
|
|
|
|
|
|
function download($url)
|
|
|
|
{
|
|
|
|
try {
|
|
|
|
$client = Client::getInstance();
|
|
|
|
$client->setUserAgent(Config\HTTP_USER_AGENT);
|
|
|
|
$client->execute($url);
|
|
|
|
|
2015-01-09 14:43:45 +01:00
|
|
|
$content = array(
|
2014-12-24 21:58:24 +01:00
|
|
|
$client->getContent(),
|
|
|
|
$client->getContentType(),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
catch (ClientException $e) {
|
2015-01-09 14:43:45 +01:00
|
|
|
$content = array(false, false);
|
2014-12-24 21:58:24 +01:00
|
|
|
}
|
2015-01-09 14:43:45 +01:00
|
|
|
|
|
|
|
Config\write_debug();
|
|
|
|
|
|
|
|
return $content;
|
2014-12-24 21:58:24 +01:00
|
|
|
}
|