|
1 | | -# PHPReolinkCameraAPI |
2 | | -PHPReolinkCameraAPI |
| 1 | +## Reolink IP camera API client class |
| 2 | + |
| 3 | +A PHP class which provides access to Reolink's IP cameras. |
| 4 | + |
| 5 | +This class can be installed manually or using composer/[packagist](https://packagist.org/packages/mm28ajos/PHPReolinkCameraAPI) for easy inclusion in your projects. |
| 6 | + |
| 7 | +## Requirements |
| 8 | + |
| 9 | +- a Reolink camera (test with RLC-420-5MP, Build No. build 19061408, Hardware No. IPC_51516M5M, Configuration Version v2.0.0.0, Firmware Version v2.0.0.448_19061408) |
| 10 | +- a web server with PHP installed (tested with PHP cli Version 7.3.11-1~deb10u1) |
| 11 | +- network connectivity between this web server and the camera and port (normally TCP port 80) |
| 12 | + |
| 13 | +## Installation ## |
| 14 | + |
| 15 | +You can use [Composer](#composer), [Git](#git) or simply [Download the Release](#download-the-release) to install the API client class. |
| 16 | + |
| 17 | +### Composer |
| 18 | + |
| 19 | +The preferred method is via [composer](https://getcomposer.org). Follow the [installation instructions](https://getcomposer.org/doc/00-intro.md) if you do not already have composer installed. |
| 20 | + |
| 21 | +Once composer is installed, simply execute this command from the shell in your project directory: |
| 22 | + |
| 23 | +```sh |
| 24 | +composer require mm28ajos/php-reolink-camera-api |
| 25 | +``` |
| 26 | + |
| 27 | + Or you can manually add the package to your composer.json file: |
| 28 | + |
| 29 | +```javascript |
| 30 | +{ |
| 31 | + "require": { |
| 32 | + "mm28ajos/php-reolink-camera-api": "^1.0" |
| 33 | + } |
| 34 | +} |
| 35 | +``` |
| 36 | + |
| 37 | +Finally, be sure to include the autoloader in your code: |
| 38 | + |
| 39 | +```php |
| 40 | +require_once('vendor/autoload.php'); |
| 41 | +``` |
| 42 | + |
| 43 | +### Git |
| 44 | + |
| 45 | +Execute the following `git` command from the shell in your project directory: |
| 46 | + |
| 47 | +```sh |
| 48 | +git clone https://github.com/mm28ajos/PHPReolinkCameraAPI.git |
| 49 | +``` |
| 50 | + |
| 51 | +When git is done cloning, include the file containing the class like so in your code: |
| 52 | + |
| 53 | +```php |
| 54 | +require_once('path/to/src/Client.php'); |
| 55 | +``` |
| 56 | + |
| 57 | +### Download the Release |
| 58 | + |
| 59 | +If you prefer not to use composer or git, you can simply [download the package](https://github.com/mm28ajos/PHPReolinkCameraAPI/archive/master.zip), uncompress the zip file, then include the file containing the class in your code like so: |
| 60 | + |
| 61 | +```php |
| 62 | +require_once('path/to/src/Client.php'); |
| 63 | +``` |
| 64 | + |
| 65 | +## Example usage |
| 66 | + |
| 67 | +A basic example how to use the class: |
| 68 | + |
| 69 | +```php |
| 70 | +/** |
| 71 | + * load the class using the composer autoloader |
| 72 | + */ |
| 73 | +require_once('vendor/autoload.php'); |
| 74 | + |
| 75 | +/** |
| 76 | + * initialize the Reolink API connection class, log in to the controller and request disable the motion detection e-mail alert |
| 77 | + * (this example assumes you have already assigned the correct values to the variables used) |
| 78 | + */ |
| 79 | +$reolink_connection = new \Reolink_API\Client($user, $password, $camera_ip); |
| 80 | +$login = $reolink_connection->login(); |
| 81 | +if ($login) |
| 82 | +{ |
| 83 | + $results = $reolink_connection->toggleMotionEmail(false); // returns a PHP boolean to signale the success/failure of toggeling the motion e-mail alert |
| 84 | + $logout = $reolink_connection->$logout(); |
| 85 | +} |
| 86 | +``` |
| 87 | + |
| 88 | +Please refer to the `examples/` directory for some more detailed examples which you can use as a starting point for your own PHP code. |
| 89 | + |
| 90 | +### API Requests Implementation: |
| 91 | + |
| 92 | +GET: |
| 93 | +- [X] Login |
| 94 | +- [X] Logout |
| 95 | +- [ ] Display -> OSD |
| 96 | +- [ ] Recording -> Encode (Clear and Fluent Stream) |
| 97 | +- [ ] Recording -> Advance (Scheduling) |
| 98 | +- [ ] Network -> General |
| 99 | +- [ ] Network -> Advanced |
| 100 | +- [ ] Network -> DDNS |
| 101 | +- [ ] Network -> NTP |
| 102 | +- [x] Network -> E-mail |
| 103 | +- [x] Network -> FTP |
| 104 | +- [x] Network -> Push |
| 105 | +- [ ] Network -> WIFI |
| 106 | +- [ ] Alarm -> Motion |
| 107 | +- [ ] System -> General |
| 108 | +- [ ] System -> DST |
| 109 | +- [ ] System -> Information |
| 110 | +- [ ] System -> Maintenance |
| 111 | +- [ ] System -> Performance |
| 112 | +- [ ] System -> Reboot |
| 113 | +- [ ] User -> Online User |
| 114 | +- [ ] User -> Add User |
| 115 | +- [ ] User -> Manage User |
| 116 | +- [ ] Device -> HDD/SD Card |
| 117 | +- [ ] Zoom |
| 118 | +- [ ] Focus |
| 119 | +- [ ] Image (Brightness, Contrass, Saturation, Hue, Sharp, Mirror, Rotate) |
| 120 | +- [x] Near Infraread Light |
| 121 | +- [ ] Advanced Image (Anti-flicker, Exposure, White Balance, DayNight, Backlight, 3D-NR) |
| 122 | +- [ ] Image Data -> "Snap" Frame from Video Stream |
| 123 | + |
| 124 | +SET: |
| 125 | +- [ ] Display -> OSD |
| 126 | +- [ ] Recording -> Encode (Clear and Fluent Stream) |
| 127 | +- [ ] Recording -> Advance (Scheduling) |
| 128 | +- [ ] Network -> General |
| 129 | +- [ ] Network -> Advanced |
| 130 | +- [ ] Network -> DDNS |
| 131 | +- [ ] Network -> NTP |
| 132 | +- [x] Network -> E-mail |
| 133 | +- [x] Network -> FTP |
| 134 | +- [x] Network -> Push |
| 135 | +- [ ] Network -> WIFI |
| 136 | +- [ ] Alarm -> Motion |
| 137 | +- [ ] System -> General |
| 138 | +- [ ] System -> DST |
| 139 | +- [ ] System -> Reboot |
| 140 | +- [ ] User -> Online User |
| 141 | +- [ ] User -> Add User |
| 142 | +- [ ] User -> Manage User |
| 143 | +- [ ] Device -> HDD/SD Card |
| 144 | +- [ ] Zoom |
| 145 | +- [ ] Focus |
| 146 | +- [ ] Image (Brightness, Contrass, Saturation, Hue, Sharp, Mirror, Rotate) |
| 147 | +- [x] Near Infraread Light |
| 148 | +- [ ] Advanced Image (Anti-flicker, Exposure, White Balance, DayNight, Backlight, 3D-NR) |
| 149 | + |
| 150 | +## Contribute |
| 151 | + |
| 152 | +If you would like to contribute code (improvements), please open an issue and include your code there or else create a pull request. |
| 153 | + |
| 154 | +## Credits |
| 155 | + |
| 156 | +This class is based on the initial work by the following developer: |
| 157 | + |
| 158 | +- klin34970: https://www.domoticz.com/forum/viewtopic.php?t=28721 |
| 159 | + |
| 160 | +The Readme is based on: |
| 161 | + |
| 162 | +- https://github.com/Art-of-WiFi/UniFi-API-client/blob/master/README.md |
| 163 | +- https://github.com/Benehiko/ReolinkCameraAPI/blob/master/README.md |
| 164 | + |
| 165 | +## Important Note |
| 166 | + |
| 167 | +All of the functions in this API client class are not officially supported by Reolink and as such, may not be supported in future versions of the Reolink cameras. |
0 commit comments