Browse Source

increased image size and for null object exception for TVIP311PI

tags/0.1.5^0
Robin Thoni 4 years ago
parent
commit
5f24ec73c6
Signed by: Robin THONI <robin@rthoni.com> GPG Key ID: 4E09DEF46B99E61E
1 changed files with 6 additions and 2 deletions
  1. 6
    2
      app/Http/Business/Cameras/Trendnet/TVIP311PI.php

+ 6
- 2
app/Http/Business/Cameras/Trendnet/TVIP311PI.php View File

44
             $this->_client->request('GET', $this->_url);
44
             $this->_client->request('GET', $this->_url);
45
         } catch (RequestException $e) {
45
         } catch (RequestException $e) {
46
             $response = $e->getResponse();
46
             $response = $e->getResponse();
47
-            if ($response->getStatusCode() == 401) {
47
+            if ($response != null && $response->getStatusCode() == 401) {
48
                 $nonce = array();
48
                 $nonce = array();
49
                 preg_match("/nonce=\"([a-f0-9]+)\"/", $response->getHeader("WWW-Authenticate")[0], $nonce);
49
                 preg_match("/nonce=\"([a-f0-9]+)\"/", $response->getHeader("WWW-Authenticate")[0], $nonce);
50
                 $nonce = $nonce[1];
50
                 $nonce = $nonce[1];
51
             }
51
             }
52
+            else {
53
+              LuLog::log($e);
54
+            }
55
+
52
         } catch (\Exception $e) {
56
         } catch (\Exception $e) {
53
             LuLog::log($e);
57
             LuLog::log($e);
54
         }
58
         }
65
                 "Connection: close\r\n".
69
                 "Connection: close\r\n".
66
                 "Accept: */*\r\n\r\n");
70
                 "Accept: */*\r\n\r\n");
67
             $data = "";
71
             $data = "";
68
-            while(substr_count($data, "--boundarySample") < 2 && socket_recv($sock, $buf, 1024, 0) && strlen($data) < 35000)
72
+            while(substr_count($data, "--boundarySample") < 2 && socket_recv($sock, $buf, 1024, 0) && strlen($data) < 50000)
69
                 $data .= $buf;
73
                 $data .= $buf;
70
             socket_close($sock);
74
             socket_close($sock);
71
             if(substr_count($data, "--boundarySample") >= 2)
75
             if(substr_count($data, "--boundarySample") >= 2)

Loading…
Cancel
Save