Нужна помощь?
Задайте вопрос специалисту технической поддержки
Ниже представлены пример подключения к СМС шлюзу на PHP
Отправка СМС:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
<?php $src = '<?xml version= "1.0" encoding= "UTF-8" ?> <SMS> <operations> <operation>SEND</operation> </operations> <authentification> <username></username> <password></password> </authentification> <message> <sender>SMS</sender> <text>Test message [UTF-8]</text> </message> <numbers> <number messageID= "msg11" >380972920000</number> </numbers> </SMS>'; $Curl = curl_init(); $CurlOptions = array ( CURLOPT_FOLLOWLOCATION=>false, CURLOPT_POST=>true, CURLOPT_HEADER=>false, CURLOPT_RETURNTRANSFER=>true, CURLOPT_CONNECTTIMEOUT=>15, CURLOPT_TIMEOUT=>100, CURLOPT_POSTFIELDS=> array ( 'XML' => $src ), ); curl_setopt_array( $Curl , $CurlOptions ); if (false === ( $Result = curl_exec( $Curl ))) { throw new Exception( 'Http request failed' ); } curl_close( $Curl ); echo $Result ; ?> |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
<?php $src = '<?xml version= "1.0" encoding= "UTF-8" ?> <SMS> <operations> <operation>GETSTATUS</operation> </operations> <authentification> <username></username> <password></password> </authentification> <statistics> <messageid>msg11</messageid> </statistics> </SMS>'; $Curl = curl_init(); $CurlOptions = array ( CURLOPT_FOLLOWLOCATION=>false, CURLOPT_POST=>true, CURLOPT_HEADER=>false, CURLOPT_RETURNTRANSFER=>true, CURLOPT_CONNECTTIMEOUT=>15, CURLOPT_TIMEOUT=>100, CURLOPT_POSTFIELDS=> array ( 'XML' => $src ), ); curl_setopt_array( $Curl , $CurlOptions ); if (false === ( $Result = curl_exec( $Curl ))) { throw new Exception( 'Http request failed' ); } curl_close( $Curl ); echo $Result ; ?> |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
<?php $src = '<?xml version= "1.0" encoding= "UTF-8" ?> <SMS> <operations> <operation>GETPRICE</operation> </operations> <authentification> <username></username> <password></password> </authentification> <message> <sender>SMS</sender> <text>Test message [UTF-8]</text> </message> <numbers> <number messageID= "msg11" >380972920000</number> </numbers> </SMS>'; $Curl = curl_init(); $CurlOptions = array ( CURLOPT_FOLLOWLOCATION=>false, CURLOPT_POST=>true, CURLOPT_HEADER=>false, CURLOPT_RETURNTRANSFER=>true, CURLOPT_CONNECTTIMEOUT=>15, CURLOPT_TIMEOUT=>100, CURLOPT_POSTFIELDS=> array ( 'XML' => $src ), ); curl_setopt_array( $Curl , $CurlOptions ); if (false === ( $Result = curl_exec( $Curl ))) { throw new Exception( 'Http request failed' ); } curl_close( $Curl ); echo $Result ; ?> |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
<?php $src = '<?xml version= "1.0" encoding= "UTF-8" ?> <SMS> <operations> <operation>BALANCE</operation> </operations> <authentification> <username></username> <password></password> </authentification> </SMS>'; $Curl = curl_init(); $CurlOptions = array ( CURLOPT_FOLLOWLOCATION=>false, CURLOPT_POST=>true, CURLOPT_HEADER=>false, CURLOPT_RETURNTRANSFER=>true, CURLOPT_CONNECTTIMEOUT=>15, CURLOPT_TIMEOUT=>100, CURLOPT_POSTFIELDS=> array ( 'XML' => $src ), ); curl_setopt_array( $Curl , $CurlOptions ); if (false === ( $Result = curl_exec( $Curl ))) { throw new Exception( 'Http request failed' ); } curl_close( $Curl ); echo $Result ; ?> |