mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-20 16:37:48 +02:00
working octopush virtual number
This commit is contained in:
parent
88ebc8042c
commit
0e2908cb83
1 changed files with 11 additions and 18 deletions
|
@ -34,11 +34,6 @@ class OctopushVirtualNumberAdapter implements AdapterInterface
|
||||||
*/
|
*/
|
||||||
private $api_key;
|
private $api_key;
|
||||||
|
|
||||||
/**
|
|
||||||
* Number phone to use.
|
|
||||||
*/
|
|
||||||
private $number;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Octopush SMS type
|
* Octopush SMS type
|
||||||
*/
|
*/
|
||||||
|
@ -49,6 +44,7 @@ class OctopushVirtualNumberAdapter implements AdapterInterface
|
||||||
*/
|
*/
|
||||||
private $api_url = 'https://api.octopush.com/v1/public';
|
private $api_url = 'https://api.octopush.com/v1/public';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adapter constructor, called when instanciated by RaspiSMS.
|
* Adapter constructor, called when instanciated by RaspiSMS.
|
||||||
*
|
*
|
||||||
|
@ -68,8 +64,6 @@ class OctopushVirtualNumberAdapter implements AdapterInterface
|
||||||
{
|
{
|
||||||
$this->sms_type = self::SMS_TYPE_PREMIUM;
|
$this->sms_type = self::SMS_TYPE_PREMIUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -119,6 +113,7 @@ class OctopushVirtualNumberAdapter implements AdapterInterface
|
||||||
Envoi de SMS avec un numéro virtuel en utilisant <a target="_blank" href="https://www.octopush.com/">Octopush</a>. Pour trouver vos clés API Octopush <a target="_blank" href="' . $credentials_url . '">cliquez ici.</a><br/>
|
Envoi de SMS avec un numéro virtuel en utilisant <a target="_blank" href="https://www.octopush.com/">Octopush</a>. Pour trouver vos clés API Octopush <a target="_blank" href="' . $credentials_url . '">cliquez ici.</a><br/>
|
||||||
Pour plus d\'information sur l\'utilisation de ce téléphone, reportez-vous à <a href="https://documentation.raspisms.fr/users/adapters/octopush_virtual_number.html" target="_blank">la documentation sur les téléphones "Octopush Numéro Virtuel".</a>
|
Pour plus d\'information sur l\'utilisation de ce téléphone, reportez-vous à <a href="https://documentation.raspisms.fr/users/adapters/octopush_virtual_number.html" target="_blank">la documentation sur les téléphones "Octopush Numéro Virtuel".</a>
|
||||||
';
|
';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -252,6 +247,7 @@ class OctopushVirtualNumberAdapter implements AdapterInterface
|
||||||
curl_setopt($curl, CURLOPT_POST, true);
|
curl_setopt($curl, CURLOPT_POST, true);
|
||||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
|
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
|
||||||
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
|
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
|
||||||
|
|
||||||
$curl_response = curl_exec($curl);
|
$curl_response = curl_exec($curl);
|
||||||
$http_code = (int) curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
$http_code = (int) curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
||||||
curl_close($curl);
|
curl_close($curl);
|
||||||
|
@ -314,11 +310,6 @@ class OctopushVirtualNumberAdapter implements AdapterInterface
|
||||||
{
|
{
|
||||||
$success = true;
|
$success = true;
|
||||||
|
|
||||||
if ($this->data['sender'] && (mb_strlen($this->data['sender']) < 3 || mb_strlen($this->data['sender'] > 11)))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($this->data['sms_type']) && !in_array($this->data['sms_type'], ['premium', 'low cost']))
|
if (!empty($this->data['sms_type']) && !in_array($this->data['sms_type'], ['premium', 'low cost']))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -330,7 +321,6 @@ class OctopushVirtualNumberAdapter implements AdapterInterface
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$headers = [
|
$headers = [
|
||||||
'api-login: ' . $this->login,
|
'api-login: ' . $this->login,
|
||||||
'api-key: ' . $this->api_key,
|
'api-key: ' . $this->api_key,
|
||||||
|
@ -423,7 +413,10 @@ class OctopushVirtualNumberAdapter implements AdapterInterface
|
||||||
$content = json_decode($input, true);
|
$content = json_decode($input, true);
|
||||||
if (null === $content)
|
if (null === $content)
|
||||||
{
|
{
|
||||||
return false;
|
$response['error'] = true;
|
||||||
|
$response['error_message'] = 'Cannot read input data from callback request.';
|
||||||
|
|
||||||
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
$number = $content['number'] ?? false;
|
$number = $content['number'] ?? false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue