| Conditions | 2 |
| Paths | 2 |
| Total Lines | 22 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | public function notifyOwner($message) |
||
| 26 | { |
||
| 27 | $url = 'https://smsapi.free-mobile.fr/sendmsg?user=' |
||
| 28 | .urlencode($this->user) |
||
| 29 | .'&pass='.urlencode($this->password) |
||
| 30 | .'&msg='.urlencode($message) |
||
| 31 | ; |
||
| 32 | |||
| 33 | $handle = curl_init($url); |
||
| 34 | curl_setopt($handle, CURLOPT_RETURNTRANSFER, TRUE); |
||
| 35 | $content = curl_exec($handle); |
||
| 36 | $httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE); |
||
| 37 | curl_close($handle); |
||
| 38 | |||
| 39 | if ($httpCode !== 200) { |
||
| 40 | $this->logger->error(sprintf( |
||
| 41 | "Error while sending SMS, API returned code %s with the following content:\n%s", |
||
| 42 | $httpCode, |
||
| 43 | $content |
||
| 44 | )); |
||
| 45 | } |
||
| 46 | } |
||
| 47 | } |
||
| 48 |