Use curl.
This commit is contained in:
parent
233c47afc1
commit
b0fe549018
@ -2,18 +2,23 @@
|
|||||||
|
|
||||||
namespace StaticMapLite\TileResolver;
|
namespace StaticMapLite\TileResolver;
|
||||||
|
|
||||||
|
use Curl\Curl;
|
||||||
|
|
||||||
class TileResolver
|
class TileResolver
|
||||||
{
|
{
|
||||||
|
protected $tileLayer = null;
|
||||||
|
|
||||||
|
protected $curl = null;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->curl = new Curl();
|
||||||
|
}
|
||||||
|
|
||||||
public function fetch(string $url): string
|
public function fetch(string $url): string
|
||||||
{
|
{
|
||||||
$ch = curl_init();
|
$this->curl->get($url);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|
||||||
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0');
|
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
|
||||||
$tile = curl_exec($ch);
|
|
||||||
curl_close($ch);
|
|
||||||
|
|
||||||
return $tile;
|
return $this->curl->response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user