3v4l.org

run code in 300+ PHP versions simultaneously
<?php ################################################## # SAMPLE PHP CODE TO SEND SMS VIA SERVAGE API ################################################## // Send SMS function function sendSMS($number,$message,$concat = 1) { $url = 'http://smsgateway.servage.net/sms.php'; $customer = 'YOURCUSTOMERID'; $key = 'YOURKEY'; $request = $url.'?customer='.$customer.'&key='.$key.'&number='.urlencode($number).'&message='.urlencode($message).'&concat='.$concat; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $request); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($ch); curl_close($ch); return split(',',$response); } // Integration in your project $sms_api_result = sendSMS('number','text','1'); // Check if SMS was received by the API or not if ($sms_api_result[0] == 'OK') { // Ok, SMS received by the API // Do something here... } else { // Failure, SMS was not received by the API // I this example we display the response to identify the error print_r($sms_api_result); } ################################################## # SAMPLE PHP CODE FOR SMS COVERAGE QUERY ################################################## // Coverage Query function function coverageQuery($number) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://smsgateway.servage.net/sms_coverage.php?number='.$number); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); curl_close($ch); if (substr($data,0,2) == 'OK') return true; else return false; } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SONiO
function name:  (null)
number of ops:  14
compiled vars:  !0 = $sms_api_result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_FCALL                                               'sendsms'
          1        SEND_VAL                                                 'number'
          2        SEND_VAL                                                 'text'
          3        SEND_VAL                                                 '1'
          4        DO_FCALL                                      0  $1      
          5        ASSIGN                                                   !0, $1
   27     6        FETCH_DIM_R                                      ~3      !0, 0
          7        IS_EQUAL                                                 ~3, 'OK'
          8      > JMPZ                                                     ~4, ->10
          9    > > JMP                                                      ->13
   34    10    >   INIT_FCALL                                               'print_r'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                                 
   55    13    > > RETURN                                                   1

Function sendsms:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SONiO
function name:  sendSMS
number of ops:  57
compiled vars:  !0 = $number, !1 = $message, !2 = $concat, !3 = $url, !4 = $customer, !5 = $key, !6 = $request, !7 = $ch, !8 = $response
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      1
   10     3        ASSIGN                                                   !3, 'http%3A%2F%2Fsmsgateway.servage.net%2Fsms.php'
   11     4        ASSIGN                                                   !4, 'YOURCUSTOMERID'
   12     5        ASSIGN                                                   !5, 'YOURKEY'
   13     6        CONCAT                                           ~12     !3, '%3Fcustomer%3D'
          7        CONCAT                                           ~13     ~12, !4
          8        CONCAT                                           ~14     ~13, '%26key%3D'
          9        CONCAT                                           ~15     ~14, !5
         10        CONCAT                                           ~16     ~15, '%26number%3D'
         11        INIT_FCALL                                               'urlencode'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $17     
         14        CONCAT                                           ~18     ~16, $17
         15        CONCAT                                           ~19     ~18, '%26message%3D'
         16        INIT_FCALL                                               'urlencode'
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                         $20     
         19        CONCAT                                           ~21     ~19, $20
         20        CONCAT                                           ~22     ~21, '%26concat%3D'
         21        CONCAT                                           ~23     ~22, !2
         22        ASSIGN                                                   !6, ~23
   14    23        INIT_FCALL_BY_NAME                                       'curl_init'
         24        DO_FCALL                                      0  $25     
         25        ASSIGN                                                   !7, $25
   15    26        INIT_FCALL_BY_NAME                                       'curl_setopt'
         27        SEND_VAR_EX                                              !7
         28        FETCH_CONSTANT                                   ~27     'CURLOPT_URL'
         29        SEND_VAL_EX                                              ~27
         30        SEND_VAR_EX                                              !6
         31        DO_FCALL                                      0          
   16    32        INIT_FCALL_BY_NAME                                       'curl_setopt'
         33        SEND_VAR_EX                                              !7
         34        FETCH_CONSTANT                                   ~29     'CURLOPT_HEADER'
         35        SEND_VAL_EX                                              ~29
         36        SEND_VAL_EX                                              0
         37        DO_FCALL                                      0          
   17    38        INIT_FCALL_BY_NAME                                       'curl_setopt'
         39        SEND_VAR_EX                                              !7
         40        FETCH_CONSTANT                                   ~31     'CURLOPT_RETURNTRANSFER'
         41        SEND_VAL_EX                                              ~31
         42        SEND_VAL_EX                                              1
         43        DO_FCALL                                      0          
   18    44        INIT_FCALL_BY_NAME                                       'curl_exec'
         45        SEND_VAR_EX                                              !7
         46        DO_FCALL                                      0  $33     
         47        ASSIGN                                                   !8, $33
   19    48        INIT_FCALL_BY_NAME                                       'curl_close'
         49        SEND_VAR_EX                                              !7
         50        DO_FCALL                                      0          
   20    51        INIT_FCALL_BY_NAME                                       'split'
         52        SEND_VAL_EX                                              '%2C'
         53        SEND_VAR_EX                                              !8
         54        DO_FCALL                                      0  $36     
         55      > RETURN                                                   $36
   21    56*     > RETURN                                                   null

End of function sendsms

Function coveragequery:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 39
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SONiO
function name:  coverageQuery
number of ops:  41
compiled vars:  !0 = $number, !1 = $ch, !2 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   43     0  E >   RECV                                             !0      
   44     1        INIT_FCALL_BY_NAME                                       'curl_init'
          2        DO_FCALL                                      0  $3      
          3        ASSIGN                                                   !1, $3
   45     4        INIT_FCALL_BY_NAME                                       'curl_setopt'
          5        SEND_VAR_EX                                              !1
          6        FETCH_CONSTANT                                   ~5      'CURLOPT_URL'
          7        SEND_VAL_EX                                              ~5
          8        CONCAT                                           ~6      'http%3A%2F%2Fsmsgateway.servage.net%2Fsms_coverage.php%3Fnumber%3D', !0
          9        SEND_VAL_EX                                              ~6
         10        DO_FCALL                                      0          
   46    11        INIT_FCALL_BY_NAME                                       'curl_setopt'
         12        SEND_VAR_EX                                              !1
         13        FETCH_CONSTANT                                   ~8      'CURLOPT_HEADER'
         14        SEND_VAL_EX                                              ~8
         15        SEND_VAL_EX                                              0
         16        DO_FCALL                                      0          
   47    17        INIT_FCALL_BY_NAME                                       'curl_setopt'
         18        SEND_VAR_EX                                              !1
         19        FETCH_CONSTANT                                   ~10     'CURLOPT_RETURNTRANSFER'
         20        SEND_VAL_EX                                              ~10
         21        SEND_VAL_EX                                              1
         22        DO_FCALL                                      0          
   48    23        INIT_FCALL_BY_NAME                                       'curl_exec'
         24        SEND_VAR_EX                                              !1
         25        DO_FCALL                                      0  $12     
         26        ASSIGN                                                   !2, $12
   49    27        INIT_FCALL_BY_NAME                                       'curl_close'
         28        SEND_VAR_EX                                              !1
         29        DO_FCALL                                      0          
   50    30        INIT_FCALL                                               'substr'
         31        SEND_VAR                                                 !2
         32        SEND_VAL                                                 0
         33        SEND_VAL                                                 2
         34        DO_ICALL                                         $15     
         35        IS_EQUAL                                                 $15, 'OK'
         36      > JMPZ                                                     ~16, ->39
         37    > > RETURN                                                   <true>
         38*       JMP                                                      ->40
   51    39    > > RETURN                                                   <false>
   52    40*     > RETURN                                                   null

End of function coveragequery

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
183.95 ms | 1406 KiB | 20 Q