3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sql = "select * from subscribe where type ='$cat' and city ='$city'"; $query = mysql_query($sql); if ($query != null) { while ($row = mysql_fetch_array($query)) { //$name = $row['name']; $phoneNum = $row['fone']; $message = "Hi Now you can buy your product."; ozekiSend($phoneNum, $message); // for debugging, try the following line //echo ozekiSend($phoneNum, $message, true); } } ######################################################## # Login information for the SMS Gateway ######################################################## $ozeki_user = "admin"; $ozeki_password = "abc123"; $ozeki_url = "http://127.0.0.1:9501/api?"; ######################################################## # Functions used to send the SMS message ######################################################## function httpRequest($url) { $pattern = "/http...([0-9a-zA-Z-.]*).([0-9]*).(.*)/"; preg_match($pattern, $url, $args); $in = ""; $fp = fsockopen("$args[1]", $args[2], $errno, $errstr, 30); if (!$fp) { return("$errstr ($errno)"); } else { $out = "GET /$args[3] HTTP/1.1\r\n"; $out .= "Host: $args[1]:$args[2]\r\n"; $out .= "User-agent: Ozeki PHP client\r\n"; $out .= "Accept: */*\r\n"; $out .= "Connection: Close\r\n\r\n"; fwrite($fp, $out); while (!feof($fp)) { $in.=fgets($fp, 128); } } fclose($fp); return($in); } function ozekiSend($phone, $msg, $debug = false) { global $ozeki_user, $ozeki_password, $ozeki_url; $url = 'username=' . $ozeki_user; $url.= '&password=' . $ozeki_password; $url.= '&action=sendmessage'; $url.= '&messagetype=SMS:TEXT'; $url.= '&recipient=' . urlencode($phone); $url.= '&messagedata=' . urlencode($msg); $urltouse = $ozeki_url . $url; if ($debug === true) { echo "Request: <br>$urltouse<br><br>"; } //Open the URL to send the message $response = httpRequest($urltouse); if ($debug === true) { echo "Response: <br><pre>" . str_replace(array("<", ">"), array("&lt;", "&gt;"), $response) . "</pre><br>"; } return($response); } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 25
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 13
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 13
Branch analysis from position: 25
Branch analysis from position: 13
Branch analysis from position: 25
filename:       /in/BeIQ9
function name:  (null)
number of ops:  29
compiled vars:  !0 = $sql, !1 = $cat, !2 = $city, !3 = $query, !4 = $phoneNum, !5 = $row, !6 = $message, !7 = $ozeki_user, !8 = $ozeki_password, !9 = $ozeki_url
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ROPE_INIT                                     5  ~11     'select+%2A+from+subscribe+where+type+%3D%27'
          1        ROPE_ADD                                      1  ~11     ~11, !1
          2        ROPE_ADD                                      2  ~11     ~11, '%27+and+city+%3D%27'
          3        ROPE_ADD                                      3  ~11     ~11, !2
          4        ROPE_END                                      4  ~10     ~11, '%27'
          5        ASSIGN                                                   !0, ~10
    3     6        INIT_FCALL_BY_NAME                                       'mysql_query'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0  $15     
          9        ASSIGN                                                   !3, $15
    5    10        IS_NOT_EQUAL                                             !3, null
         11      > JMPZ                                                     ~17, ->25
    6    12    > > JMP                                                      ->20
    9    13    >   FETCH_DIM_R                                      ~18     !5, 'fone'
         14        ASSIGN                                                   !4, ~18
   10    15        ASSIGN                                                   !6, 'Hi+Now+you+can+buy+your+product.'
   12    16        INIT_FCALL_BY_NAME                                       'ozekiSend'
         17        SEND_VAR_EX                                              !4
         18        SEND_VAR_EX                                              !6
         19        DO_FCALL                                      0          
    6    20    >   INIT_FCALL_BY_NAME                                       'mysql_fetch_array'
         21        SEND_VAR_EX                                              !3
         22        DO_FCALL                                      0  $22     
         23        ASSIGN                                           ~23     !5, $22
         24      > JMPNZ                                                    ~23, ->13
   23    25    >   ASSIGN                                                   !7, 'admin'
   24    26        ASSIGN                                                   !8, 'abc123'
   25    27        ASSIGN                                                   !9, 'http%3A%2F%2F127.0.0.1%3A9501%2Fapi%3F'
   81    28      > RETURN                                                   1

Function httprequest:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 27
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 53
Branch analysis from position: 53
2 jumps found. (Code = 44) Position 1 = 58, Position 2 = 48
Branch analysis from position: 58
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 48
2 jumps found. (Code = 44) Position 1 = 58, Position 2 = 48
Branch analysis from position: 58
Branch analysis from position: 48
filename:       /in/BeIQ9
function name:  httpRequest
number of ops:  63
compiled vars:  !0 = $url, !1 = $pattern, !2 = $args, !3 = $in, !4 = $fp, !5 = $errno, !6 = $errstr, !7 = $out
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   RECV                                             !0      
   33     1        ASSIGN                                                   !1, '%2Fhttp...%28%5B0-9a-zA-Z-.%5D%2A%29.%28%5B0-9%5D%2A%29.%28.%2A%29%2F'
   34     2        INIT_FCALL                                               'preg_match'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !2
          6        DO_ICALL                                                 
   35     7        ASSIGN                                                   !3, ''
   36     8        INIT_FCALL                                               'fsockopen'
          9        FETCH_DIM_R                                      ~11     !2, 1
         10        CAST                                          6  ~12     ~11
         11        SEND_VAL                                                 ~12
         12        FETCH_DIM_R                                      ~13     !2, 2
         13        SEND_VAL                                                 ~13
         14        SEND_REF                                                 !5
         15        SEND_REF                                                 !6
         16        SEND_VAL                                                 30
         17        DO_ICALL                                         $14     
         18        ASSIGN                                                   !4, $14
   37    19        BOOL_NOT                                         ~16     !4
         20      > JMPZ                                                     ~16, ->27
   38    21    >   ROPE_INIT                                     4  ~18     !6
         22        ROPE_ADD                                      1  ~18     ~18, '+%28'
         23        ROPE_ADD                                      2  ~18     ~18, !5
         24        ROPE_END                                      3  ~17     ~18, '%29'
         25      > RETURN                                                   ~17
         26*       JMP                                                      ->58
   40    27    >   ROPE_INIT                                     3  ~22     'GET+%2F'
         28        FETCH_DIM_R                                      ~20     !2, 3
         29        ROPE_ADD                                      1  ~22     ~22, ~20
         30        ROPE_END                                      2  ~21     ~22, '+HTTP%2F1.1%0D%0A'
         31        ASSIGN                                                   !7, ~21
   41    32        ROPE_INIT                                     5  ~28     'Host%3A+'
         33        FETCH_DIM_R                                      ~25     !2, 1
         34        ROPE_ADD                                      1  ~28     ~28, ~25
         35        ROPE_ADD                                      2  ~28     ~28, '%3A'
         36        FETCH_DIM_R                                      ~26     !2, 2
         37        ROPE_ADD                                      3  ~28     ~28, ~26
         38        ROPE_END                                      4  ~27     ~28, '%0D%0A'
         39        ASSIGN_OP                                     8          !7, ~27
   42    40        ASSIGN_OP                                     8          !7, 'User-agent%3A+Ozeki+PHP+client%0D%0A'
   43    41        ASSIGN_OP                                     8          !7, 'Accept%3A+%2A%2F%2A%0D%0A'
   44    42        ASSIGN_OP                                     8          !7, 'Connection%3A+Close%0D%0A%0D%0A'
   46    43        INIT_FCALL                                               'fwrite'
         44        SEND_VAR                                                 !4
         45        SEND_VAR                                                 !7
         46        DO_ICALL                                                 
   47    47      > JMP                                                      ->53
   48    48    >   INIT_FCALL                                               'fgets'
         49        SEND_VAR                                                 !4
         50        SEND_VAL                                                 128
         51        DO_ICALL                                         $36     
         52        ASSIGN_OP                                     8          !3, $36
   47    53    >   INIT_FCALL                                               'feof'
         54        SEND_VAR                                                 !4
         55        DO_ICALL                                         $38     
         56        BOOL_NOT                                         ~39     $38
         57      > JMPNZ                                                    ~39, ->48
   51    58    >   INIT_FCALL                                               'fclose'
         59        SEND_VAR                                                 !4
         60        DO_ICALL                                                 
   52    61      > RETURN                                                   !3
   53    62*     > RETURN                                                   null

End of function httprequest

Function ozekisend:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 30
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 44
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 44
Branch analysis from position: 30
filename:       /in/BeIQ9
function name:  ozekiSend
number of ops:  46
compiled vars:  !0 = $phone, !1 = $msg, !2 = $debug, !3 = $ozeki_user, !4 = $ozeki_password, !5 = $ozeki_url, !6 = $url, !7 = $urltouse, !8 = $response
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   55     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      <false>
   57     3        BIND_GLOBAL                                              !3, 'ozeki_user'
          4        BIND_GLOBAL                                              !4, 'ozeki_password'
          5        BIND_GLOBAL                                              !5, 'ozeki_url'
   59     6        CONCAT                                           ~9      'username%3D', !3
          7        ASSIGN                                                   !6, ~9
   60     8        CONCAT                                           ~11     '%26password%3D', !4
          9        ASSIGN_OP                                     8          !6, ~11
   61    10        ASSIGN_OP                                     8          !6, '%26action%3Dsendmessage'
   62    11        ASSIGN_OP                                     8          !6, '%26messagetype%3DSMS%3ATEXT'
   63    12        INIT_FCALL                                               'urlencode'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $15     
         15        CONCAT                                           ~16     '%26recipient%3D', $15
         16        ASSIGN_OP                                     8          !6, ~16
   64    17        INIT_FCALL                                               'urlencode'
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                         $18     
         20        CONCAT                                           ~19     '%26messagedata%3D', $18
         21        ASSIGN_OP                                     8          !6, ~19
   66    22        CONCAT                                           ~21     !5, !6
         23        ASSIGN                                                   !7, ~21
   67    24        TYPE_CHECK                                    8          !2
         25      > JMPZ                                                     ~23, ->30
   68    26    >   ROPE_INIT                                     3  ~25     'Request%3A+%3Cbr%3E'
         27        ROPE_ADD                                      1  ~25     ~25, !7
         28        ROPE_END                                      2  ~24     ~25, '%3Cbr%3E%3Cbr%3E'
         29        ECHO                                                     ~24
   72    30    >   INIT_FCALL                                               'httprequest'
         31        SEND_VAR                                                 !7
         32        DO_FCALL                                      0  $27     
         33        ASSIGN                                                   !8, $27
   73    34        TYPE_CHECK                                    8          !2
         35      > JMPZ                                                     ~29, ->44
   75    36    >   INIT_FCALL                                               'str_replace'
         37        SEND_VAL                                                 <array>
         38        SEND_VAL                                                 <array>
         39        SEND_VAR                                                 !8
         40        DO_ICALL                                         $30     
         41        CONCAT                                           ~31     'Response%3A+%3Cbr%3E%3Cpre%3E', $30
   76    42        CONCAT                                           ~32     ~31, '%3C%2Fpre%3E%3Cbr%3E'
         43        ECHO                                                     ~32
   79    44    > > RETURN                                                   !8
   80    45*     > RETURN                                                   null

End of function ozekisend

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.59 ms | 1415 KiB | 30 Q