123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
- /**
- * Created by PhpStorm.
- * User: robin
- * Date: 8/21/16
- * Time: 3:25 PM
- */
-
- namespace App\Http\Business\Cameras\Elro;
-
-
- use App\Http\Business\Cameras\AbstractCamera;
- use App\Http\DBO\CamerasDbo;
- use GuzzleHttp\Client;
- use Luticate\Utils\LuLog;
-
- class C903IP extends AbstractCamera
- {
- const URI = "/snapshot.cgi";
-
- private $_client;
- private $_url;
-
- public function __construct(CamerasDbo $camera)
- {
- parent::__construct($camera);
- $this->_client = new Client();
- $data = $camera->getData();
- $this->_url = "http://" . $data["Host"] . ":" . $data["Port"] . self::URI;
- }
-
- public function prepareImage()
- {
- $username = $this->_camera->getData()["Username"];
- $passwd = $this->_camera->getData()["Password"];
-
- try {
- $response = $this->_client->request('GET', $this->_url, ['auth' => [
- $username,
- $passwd
- ]]);
- $data = (string)$response->getBody();
- $this->_image = $this->_imagine->load($data);
- } catch (\Exception $e) {
- LuLog::log($e);
- }
- }
- }
|