3v4l.org

run code in 300+ PHP versions simultaneously
<?php //////============================== session_start(); //*********** echo "what now"; exit; class SendSMSclass { //input parameters --------------------- var $username; //your username var $password; //your password var $sender; //sender text var $message; //message text var $flash; //Is flash message (1 or 0) var $inputgsmnumbers = array(); //destination gsm numbers var $type; //msg type ("bookmark" - for wap push, "longSMS" for text messages only) var $bookmark; //wap url (example: www.google.com) //-------------------------------------- var $host; var $path; var $XMLgsmnumbers; var $xmldata; var $request_data; var $response; function SendSMS($username, $password, $sender, $message, $flash, $inputgsmnumbers, $type, $bookmark) { $this->username = $username; $this->password = $password; $this->sender = htmlspecialchars($sender, ENT_QUOTES); $this->message = htmlspecialchars($message, ENT_QUOTES); $this->flash = $flash; $this->inputgsmnumbers = $inputgsmnumbers; $this->type = $type; $this->bookmark = $bookmark; $this->host = "api2.infobip.com"; $this->path = "/api/sendsms/xml"; $this->convertGSMnumberstoXML(); $this->prepareXMLdata(); $this->response = $this->doPost($this->path,$this->request_data,$this->host); return $this->response; } function convertGSMnumberstoXML() { $gsmcount = count($this->inputgsmnumbers); #counts gsm numbers for ( $i = 0; $i < $gsmcount; $i++ ) { $this->XMLgsmnumbers .= "<gsm>" . $this->inputgsmnumbers[$i] . "</gsm>"; } } function prepareXMLdata() { $this->xmldata = "<SMS><authentification><username>" . $this->username . "</username><password>" . $this->password . "</password></authentification><message><sender>" . $this->sender . "</sender><text>" . $this->message . "</text><flash>" . $this->flash . "</flash><type>" . $this->type . "</type><bookmark>" . $this->bookmark . "</bookmark></message><recipients>" . $this->XMLgsmnumbers . "</recipients></SMS>"; $this->request_data = 'XML=' . $this->xmldata; } function doPost($uri,$postdata,$host){ $da = fsockopen($host, 80, $errno, $errstr); if (!$da) { return "$errstr ($errno)"; } else { $salida ="POST $uri HTTP/1.1\r\n"; $salida.="Host: $host\r\n"; $salida.="User-Agent: PHP Script\r\n"; $salida.="Content-Type: text/xml\r\n"; $salida.="Content-Length: ".strlen($postdata)."\r\n"; $salida.="Connection: close\r\n\r\n"; $salida.=$postdata; fwrite($da, $salida); while (!feof($da)) $response.=fgets($da, 128); $response=split("\r\n\r\n",$response); $header=$response[0]; $responsecontent=$response[1]; if(!(strpos($header,"Transfer-Encoding: chunked")===false)){ $aux=split("\r\n",$responsecontent); for($i=0;$i<count($aux);$i++) if($i==0 || ($i%2==0)) $aux[$i]=""; $responsecontent=implode("",$aux); }//if return chop($responsecontent); }//else } } // *************** $mygsm= $_SESSION['gsm']; $myprovider = $_SESSION['provider'] ; $myproviderpassword = $_SESSION['providerpassword'] ; $mygsmchallenge= $_SESSION['gsmchallenge'] ; //$mygsm= "xxx" ; //$myprovider = "xxx"; //$myprovider = "xxxx"; //$mygsmchallenge= "xxx" ; $gsm = array(); $gsm[0] = $mygsm ; $username =$myprovider ; $password =$myproviderpassword ; $sender = "Psq"; $isflash = 0; $type ="longSMS" ; $bookmark = "what mark"; $messagetext = "psq: Write GSM code ".$mygsmchallenge." in your computer and click log in" ; // Note: replace sign "+" with "%2b" for sender and message text or it will be replaced with empty space $sender = str_replace("+","%2b",$sender); $messagetext = str_replace("+","%2b",$messagetext); $SENDSMS = new SendSMSclass(); $response = $SENDSMS->SendSMS($username,$password,$sender,$messagetext,$isflash, $gsm, $type, $bookmark); //IsFlash must be 0 or 1 //echo $response; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/sv4sn
function name:  (null)
number of ops:  55
compiled vars:  !0 = $mygsm, !1 = $myprovider, !2 = $myproviderpassword, !3 = $mygsmchallenge, !4 = $gsm, !5 = $username, !6 = $password, !7 = $sender, !8 = $isflash, !9 = $type, !10 = $bookmark, !11 = $messagetext, !12 = $SENDSMS, !13 = $response
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'session_start'
          1        DO_ICALL                                                 
    5     2        ECHO                                                     'what+now'
    6     3      > EXIT                                                     
  103     4*       FETCH_R                      global              ~15     '_SESSION'
          5*       FETCH_DIM_R                                      ~16     ~15, 'gsm'
          6*       ASSIGN                                                   !0, ~16
  104     7*       FETCH_R                      global              ~18     '_SESSION'
          8*       FETCH_DIM_R                                      ~19     ~18, 'provider'
          9*       ASSIGN                                                   !1, ~19
  105    10*       FETCH_R                      global              ~21     '_SESSION'
         11*       FETCH_DIM_R                                      ~22     ~21, 'providerpassword'
         12*       ASSIGN                                                   !2, ~22
  106    13*       FETCH_R                      global              ~24     '_SESSION'
         14*       FETCH_DIM_R                                      ~25     ~24, 'gsmchallenge'
         15*       ASSIGN                                                   !3, ~25
  113    16*       ASSIGN                                                   !4, <array>
  114    17*       ASSIGN_DIM                                               !4, 0
         18*       OP_DATA                                                  !0
  116    19*       ASSIGN                                                   !5, !1
  117    20*       ASSIGN                                                   !6, !2
  118    21*       ASSIGN                                                   !7, 'Psq'
  119    22*       ASSIGN                                                   !8, 0
  120    23*       ASSIGN                                                   !9, 'longSMS'
  121    24*       ASSIGN                                                   !10, 'what+mark'
  122    25*       CONCAT                                           ~35     'psq%3A+Write+GSM+code+', !3
         26*       CONCAT                                           ~36     ~35, '+in+your+computer+and+click+log+in'
         27*       ASSIGN                                                   !11, ~36
  125    28*       INIT_FCALL                                               'str_replace'
         29*       SEND_VAL                                                 '%2B'
         30*       SEND_VAL                                                 '%252b'
         31*       SEND_VAR                                                 !7
         32*       DO_ICALL                                         $38     
         33*       ASSIGN                                                   !7, $38
  126    34*       INIT_FCALL                                               'str_replace'
         35*       SEND_VAL                                                 '%2B'
         36*       SEND_VAL                                                 '%252b'
         37*       SEND_VAR                                                 !11
         38*       DO_ICALL                                         $40     
         39*       ASSIGN                                                   !11, $40
  128    40*       NEW                                              $42     'SendSMSclass'
         41*       DO_FCALL                                      0          
         42*       ASSIGN                                                   !12, $42
  129    43*       INIT_METHOD_CALL                                         !12, 'SendSMS'
         44*       SEND_VAR_EX                                              !5
         45*       SEND_VAR_EX                                              !6
         46*       SEND_VAR_EX                                              !7
         47*       SEND_VAR_EX                                              !11
         48*       SEND_VAR_EX                                              !8
         49*       SEND_VAR_EX                                              !4
         50*       SEND_VAR_EX                                              !9
         51*       SEND_VAR_EX                                              !10
         52*       DO_FCALL                                      0  $45     
         53*       ASSIGN                                                   !13, $45
  135    54*     > RETURN                                                   1

Class SendSMSclass:
Function sendsms:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sv4sn
function name:  SendSMS
number of ops:  56
compiled vars:  !0 = $username, !1 = $password, !2 = $sender, !3 = $message, !4 = $flash, !5 = $inputgsmnumbers, !6 = $type, !7 = $bookmark
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        RECV                                             !4      
          5        RECV                                             !5      
          6        RECV                                             !6      
          7        RECV                                             !7      
   32     8        ASSIGN_OBJ                                               'username'
          9        OP_DATA                                                  !0
   33    10        ASSIGN_OBJ                                               'password'
         11        OP_DATA                                                  !1
   34    12        INIT_FCALL                                               'htmlspecialchars'
         13        SEND_VAR                                                 !2
         14        SEND_VAL                                                 3
         15        DO_ICALL                                         $11     
         16        ASSIGN_OBJ                                               'sender'
         17        OP_DATA                                                  $11
   35    18        INIT_FCALL                                               'htmlspecialchars'
         19        SEND_VAR                                                 !3
         20        SEND_VAL                                                 3
         21        DO_ICALL                                         $13     
         22        ASSIGN_OBJ                                               'message'
         23        OP_DATA                                                  $13
   36    24        ASSIGN_OBJ                                               'flash'
         25        OP_DATA                                                  !4
   37    26        ASSIGN_OBJ                                               'inputgsmnumbers'
         27        OP_DATA                                                  !5
   38    28        ASSIGN_OBJ                                               'type'
         29        OP_DATA                                                  !6
   39    30        ASSIGN_OBJ                                               'bookmark'
         31        OP_DATA                                                  !7
   41    32        ASSIGN_OBJ                                               'host'
         33        OP_DATA                                                  'api2.infobip.com'
   42    34        ASSIGN_OBJ                                               'path'
         35        OP_DATA                                                  '%2Fapi%2Fsendsms%2Fxml'
   44    36        INIT_METHOD_CALL                                         'convertGSMnumberstoXML'
         37        DO_FCALL                                      0          
   45    38        INIT_METHOD_CALL                                         'prepareXMLdata'
         39        DO_FCALL                                      0          
   47    40        INIT_METHOD_CALL                                         'doPost'
         41        CHECK_FUNC_ARG                                           
         42        FETCH_OBJ_FUNC_ARG                               $23     'path'
         43        SEND_FUNC_ARG                                            $23
         44        CHECK_FUNC_ARG                                           
         45        FETCH_OBJ_FUNC_ARG                               $24     'request_data'
         46        SEND_FUNC_ARG                                            $24
         47        CHECK_FUNC_ARG                                           
         48        FETCH_OBJ_FUNC_ARG                               $25     'host'
         49        SEND_FUNC_ARG                                            $25
         50        DO_FCALL                                      0  $26     
         51        ASSIGN_OBJ                                               'response'
         52        OP_DATA                                                  $26
   48    53        FETCH_OBJ_R                                      ~27     'response'
         54      > RETURN                                                   ~27
   49    55*     > RETURN                                                   null

End of function sendsms

Function convertgsmnumberstoxml:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 5
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 5
Branch analysis from position: 14
Branch analysis from position: 5
filename:       /in/sv4sn
function name:  convertGSMnumberstoXML
number of ops:  15
compiled vars:  !0 = $gsmcount, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   53     0  E >   FETCH_OBJ_R                                      ~2      'inputgsmnumbers'
          1        COUNT                                            ~3      ~2
          2        ASSIGN                                                   !0, ~3
   55     3        ASSIGN                                                   !1, 0
          4      > JMP                                                      ->12
   57     5    >   FETCH_OBJ_R                                      ~7      'inputgsmnumbers'
          6        FETCH_DIM_R                                      ~8      ~7, !1
          7        CONCAT                                           ~9      '%3Cgsm%3E', ~8
          8        CONCAT                                           ~10     ~9, '%3C%2Fgsm%3E'
          9        ASSIGN_OBJ_OP                                 8          'XMLgsmnumbers'
         10        OP_DATA                                                  ~10
   55    11        PRE_INC                                                  !1
         12    >   IS_SMALLER                                               !1, !0
         13      > JMPNZ                                                    ~12, ->5
   59    14    > > RETURN                                                   null

End of function convertgsmnumberstoxml

Function preparexmldata:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sv4sn
function name:  prepareXMLdata
number of ops:  31
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   63     0  E >   FETCH_OBJ_R                                      ~1      'username'
          1        CONCAT                                           ~2      '%3CSMS%3E%3Cauthentification%3E%3Cusername%3E', ~1
          2        CONCAT                                           ~3      ~2, '%3C%2Fusername%3E%3Cpassword%3E'
          3        FETCH_OBJ_R                                      ~4      'password'
          4        CONCAT                                           ~5      ~3, ~4
          5        CONCAT                                           ~6      ~5, '%3C%2Fpassword%3E%3C%2Fauthentification%3E%3Cmessage%3E%3Csender%3E'
          6        FETCH_OBJ_R                                      ~7      'sender'
          7        CONCAT                                           ~8      ~6, ~7
          8        CONCAT                                           ~9      ~8, '%3C%2Fsender%3E%3Ctext%3E'
          9        FETCH_OBJ_R                                      ~10     'message'
         10        CONCAT                                           ~11     ~9, ~10
         11        CONCAT                                           ~12     ~11, '%3C%2Ftext%3E%3Cflash%3E'
         12        FETCH_OBJ_R                                      ~13     'flash'
         13        CONCAT                                           ~14     ~12, ~13
         14        CONCAT                                           ~15     ~14, '%3C%2Fflash%3E%3Ctype%3E'
         15        FETCH_OBJ_R                                      ~16     'type'
         16        CONCAT                                           ~17     ~15, ~16
         17        CONCAT                                           ~18     ~17, '%3C%2Ftype%3E%3Cbookmark%3E'
         18        FETCH_OBJ_R                                      ~19     'bookmark'
         19        CONCAT                                           ~20     ~18, ~19
         20        CONCAT                                           ~21     ~20, '%3C%2Fbookmark%3E%3C%2Fmessage%3E%3Crecipients%3E'
         21        FETCH_OBJ_R                                      ~22     'XMLgsmnumbers'
         22        CONCAT                                           ~23     ~21, ~22
         23        CONCAT                                           ~24     ~23, '%3C%2Frecipients%3E%3C%2FSMS%3E'
         24        ASSIGN_OBJ                                               'xmldata'
         25        OP_DATA                                                  ~24
   64    26        FETCH_OBJ_R                                      ~26     'xmldata'
         27        CONCAT                                           ~27     'XML%3D', ~26
         28        ASSIGN_OBJ                                               'request_data'
         29        OP_DATA                                                  ~27
   65    30      > RETURN                                                   null

End of function preparexmldata

Function dopost:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 18
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
2 jumps found. (Code = 44) Position 1 = 49, Position 2 = 39
Branch analysis from position: 49
2 jumps found. (Code = 43) Position 1 = 65, Position 2 = 89
Branch analysis from position: 65
1 jumps found. (Code = 42) Position 1 = 81
Branch analysis from position: 81
2 jumps found. (Code = 44) Position 1 = 84, Position 2 = 72
Branch analysis from position: 84
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 72
2 jumps found. (Code = 47) Position 1 = 74, Position 2 = 77
Branch analysis from position: 74
2 jumps found. (Code = 43) Position 1 = 78, Position 2 = 80
Branch analysis from position: 78
2 jumps found. (Code = 44) Position 1 = 84, Position 2 = 72
Branch analysis from position: 84
Branch analysis from position: 72
Branch analysis from position: 80
Branch analysis from position: 77
Branch analysis from position: 89
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 49, Position 2 = 39
Branch analysis from position: 49
Branch analysis from position: 39
filename:       /in/sv4sn
function name:  doPost
number of ops:  94
compiled vars:  !0 = $uri, !1 = $postdata, !2 = $host, !3 = $da, !4 = $errno, !5 = $errstr, !6 = $salida, !7 = $response, !8 = $header, !9 = $responsecontent, !10 = $aux, !11 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   67     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   68     3        INIT_FCALL                                               'fsockopen'
          4        SEND_VAR                                                 !2
          5        SEND_VAL                                                 80
          6        SEND_REF                                                 !4
          7        SEND_REF                                                 !5
          8        DO_ICALL                                         $12     
          9        ASSIGN                                                   !3, $12
   69    10        BOOL_NOT                                         ~14     !3
         11      > JMPZ                                                     ~14, ->18
   71    12    >   ROPE_INIT                                     4  ~16     !5
         13        ROPE_ADD                                      1  ~16     ~16, '+%28'
         14        ROPE_ADD                                      2  ~16     ~16, !4
         15        ROPE_END                                      3  ~15     ~16, '%29'
         16      > RETURN                                                   ~15
         17*       JMP                                                      ->93
   74    18    >   ROPE_INIT                                     3  ~19     'POST+'
         19        ROPE_ADD                                      1  ~19     ~19, !0
         20        ROPE_END                                      2  ~18     ~19, '++HTTP%2F1.1%0D%0A'
         21        ASSIGN                                                   !6, ~18
   75    22        ROPE_INIT                                     3  ~23     'Host%3A+'
         23        ROPE_ADD                                      1  ~23     ~23, !2
         24        ROPE_END                                      2  ~22     ~23, '%0D%0A'
         25        ASSIGN_OP                                     8          !6, ~22
   76    26        ASSIGN_OP                                     8          !6, 'User-Agent%3A+PHP+Script%0D%0A'
   77    27        ASSIGN_OP                                     8          !6, 'Content-Type%3A+text%2Fxml%0D%0A'
   78    28        STRLEN                                           ~28     !1
         29        CONCAT                                           ~29     'Content-Length%3A+', ~28
         30        CONCAT                                           ~30     ~29, '%0D%0A'
         31        ASSIGN_OP                                     8          !6, ~30
   79    32        ASSIGN_OP                                     8          !6, 'Connection%3A+close%0D%0A%0D%0A'
   80    33        ASSIGN_OP                                     8          !6, !1
   81    34        INIT_FCALL                                               'fwrite'
         35        SEND_VAR                                                 !3
         36        SEND_VAR                                                 !6
         37        DO_ICALL                                                 
   82    38      > JMP                                                      ->44
   83    39    >   INIT_FCALL                                               'fgets'
         40        SEND_VAR                                                 !3
         41        SEND_VAL                                                 128
         42        DO_ICALL                                         $35     
         43        ASSIGN_OP                                     8          !7, $35
   82    44    >   INIT_FCALL                                               'feof'
         45        SEND_VAR                                                 !3
         46        DO_ICALL                                         $37     
         47        BOOL_NOT                                         ~38     $37
         48      > JMPNZ                                                    ~38, ->39
   84    49    >   INIT_FCALL_BY_NAME                                       'split'
         50        SEND_VAL_EX                                              '%0D%0A%0D%0A'
         51        SEND_VAR_EX                                              !7
         52        DO_FCALL                                      0  $39     
         53        ASSIGN                                                   !7, $39
   85    54        FETCH_DIM_R                                      ~41     !7, 0
         55        ASSIGN                                                   !8, ~41
   86    56        FETCH_DIM_R                                      ~43     !7, 1
         57        ASSIGN                                                   !9, ~43
   87    58        INIT_FCALL                                               'strpos'
         59        SEND_VAR                                                 !8
         60        SEND_VAL                                                 'Transfer-Encoding%3A+chunked'
         61        DO_ICALL                                         $45     
         62        TYPE_CHECK                                    4  ~46     $45
         63        BOOL_NOT                                         ~47     ~46
         64      > JMPZ                                                     ~47, ->89
   88    65    >   INIT_FCALL_BY_NAME                                       'split'
         66        SEND_VAL_EX                                              '%0D%0A'
         67        SEND_VAR_EX                                              !9
         68        DO_FCALL                                      0  $48     
         69        ASSIGN                                                   !10, $48
   89    70        ASSIGN                                                   !11, 0
         71      > JMP                                                      ->81
   90    72    >   IS_EQUAL                                         ~51     !11, 0
         73      > JMPNZ_EX                                         ~51     ~51, ->77
         74    >   MOD                                              ~52     !11, 2
         75        IS_EQUAL                                         ~53     ~52, 0
         76        BOOL                                             ~51     ~53
         77    > > JMPZ                                                     ~51, ->80
   91    78    >   ASSIGN_DIM                                               !10, !11
         79        OP_DATA                                                  ''
   89    80    >   PRE_INC                                                  !11
         81    >   COUNT                                            ~56     !10
         82        IS_SMALLER                                               !11, ~56
         83      > JMPNZ                                                    ~57, ->72
   92    84    >   INIT_FCALL                                               'implode'
         85        SEND_VAL                                                 ''
         86        SEND_VAR                                                 !10
         87        DO_ICALL                                         $58     
         88        ASSIGN                                                   !9, $58
   94    89    >   INIT_FCALL                                               'chop'
         90        SEND_VAR                                                 !9
         91        DO_ICALL                                         $60     
         92      > RETURN                                                   $60
   96    93*     > RETURN                                                   null

End of function dopost

End of class SendSMSclass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.48 ms | 1412 KiB | 33 Q