3v4l.org

run code in 300+ PHP versions simultaneously
<?php function obj2arr($d) { if (is_object($d)) {$d = get_object_vars($d);} if (is_array($d)) {return array_map(__FUNCTION__, $d);} else {return $d;} } $headers = array(); $postdata = '{"method":"global.login","params":{"userName":"admin","password":"","clientType":"Dahua3.0-Web3.0-NOTIE"},"id":10000}'; $cam = curl_init();curl_setopt($cam,CURLOPT_CUSTOMREQUEST, "POST");curl_setopt($cam,CURLOPT_URL,"http://180.211.114.50:8011/RPC2_Login");curl_setopt($cam,CURLOPT_RETURNTRANSFER,true);curl_setopt($cam,CURLOPT_HTTPHEADER, $headers);curl_setopt($cam,CURLOPT_TIMEOUT,60);curl_setopt($cam,CURLOPT_POSTFIELDS, $postdata); $result=obj2arr(json_decode(curl_exec($cam)));$id = $result['session']; //$headers = array('Cookie:DHLangCookie30=%2Fweb_lang%2FEnglish.txt; DhWebCookie=%7B%22username%22%3A%22admin%22%2C%22pswd%22%3A%22%22%2C%22talktype%22%3A%221%22%2C%22logintype%22%3A%220%22%2C%22openall%22%3A%221%22%2C%22loginid%22%3A0%7D; DhWebClientSessionID=' . $id); $postdata = '{"method":"global.login","session":'.$id.',"params":{"userName":"admin","password":"6QNMIQGe","clientType":"Dahua3.0-Web3.0-NOTIE","authorityType":"OldDigest"},"id":10000}:'; curl_setopt($cam,CURLOPT_POSTFIELDS, $postdata); curl_exec($cam);curl_close($cam); for($a =0; $a<=15;$a++) { echo "<img src='http://180.211.114.50:8011/cgi-bin/Snapshot.cgi?channel={$a}&sessionId={$id}' width='352' height='288'>"; } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 77
Branch analysis from position: 77
2 jumps found. (Code = 44) Position 1 = 79, Position 2 = 70
Branch analysis from position: 79
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 70
2 jumps found. (Code = 44) Position 1 = 79, Position 2 = 70
Branch analysis from position: 79
Branch analysis from position: 70
filename:       /in/71g1V
function name:  (null)
number of ops:  80
compiled vars:  !0 = $headers, !1 = $postdata, !2 = $cam, !3 = $result, !4 = $id, !5 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, <array>
   10     1        ASSIGN                                                   !1, '%7B%22method%22%3A%22global.login%22%2C%22params%22%3A%7B%22userName%22%3A%22admin%22%2C%22password%22%3A%22%22%2C%22clientType%22%3A%22Dahua3.0-Web3.0-NOTIE%22%7D%2C%22id%22%3A10000%7D'
   12     2        INIT_FCALL_BY_NAME                                       'curl_init'
          3        DO_FCALL                                      0  $8      
          4        ASSIGN                                                   !2, $8
          5        INIT_FCALL_BY_NAME                                       'curl_setopt'
          6        SEND_VAR_EX                                              !2
          7        FETCH_CONSTANT                                   ~10     'CURLOPT_CUSTOMREQUEST'
          8        SEND_VAL_EX                                              ~10
          9        SEND_VAL_EX                                              'POST'
         10        DO_FCALL                                      0          
         11        INIT_FCALL_BY_NAME                                       'curl_setopt'
         12        SEND_VAR_EX                                              !2
         13        FETCH_CONSTANT                                   ~12     'CURLOPT_URL'
         14        SEND_VAL_EX                                              ~12
         15        SEND_VAL_EX                                              'http%3A%2F%2F180.211.114.50%3A8011%2FRPC2_Login'
         16        DO_FCALL                                      0          
         17        INIT_FCALL_BY_NAME                                       'curl_setopt'
         18        SEND_VAR_EX                                              !2
         19        FETCH_CONSTANT                                   ~14     'CURLOPT_RETURNTRANSFER'
         20        SEND_VAL_EX                                              ~14
         21        SEND_VAL_EX                                              <true>
         22        DO_FCALL                                      0          
         23        INIT_FCALL_BY_NAME                                       'curl_setopt'
         24        SEND_VAR_EX                                              !2
         25        FETCH_CONSTANT                                   ~16     'CURLOPT_HTTPHEADER'
         26        SEND_VAL_EX                                              ~16
         27        SEND_VAR_EX                                              !0
         28        DO_FCALL                                      0          
         29        INIT_FCALL_BY_NAME                                       'curl_setopt'
         30        SEND_VAR_EX                                              !2
         31        FETCH_CONSTANT                                   ~18     'CURLOPT_TIMEOUT'
         32        SEND_VAL_EX                                              ~18
         33        SEND_VAL_EX                                              60
         34        DO_FCALL                                      0          
         35        INIT_FCALL_BY_NAME                                       'curl_setopt'
         36        SEND_VAR_EX                                              !2
         37        FETCH_CONSTANT                                   ~20     'CURLOPT_POSTFIELDS'
         38        SEND_VAL_EX                                              ~20
         39        SEND_VAR_EX                                              !1
         40        DO_FCALL                                      0          
   13    41        INIT_FCALL                                               'obj2arr'
         42        INIT_FCALL                                               'json_decode'
         43        INIT_FCALL_BY_NAME                                       'curl_exec'
         44        SEND_VAR_EX                                              !2
         45        DO_FCALL                                      0  $22     
         46        SEND_VAR                                                 $22
         47        DO_ICALL                                         $23     
         48        SEND_VAR                                                 $23
         49        DO_FCALL                                      0  $24     
         50        ASSIGN                                                   !3, $24
         51        FETCH_DIM_R                                      ~26     !3, 'session'
         52        ASSIGN                                                   !4, ~26
   17    53        CONCAT                                           ~28     '%7B%22method%22%3A%22global.login%22%2C%22session%22%3A', !4
         54        CONCAT                                           ~29     ~28, '%2C%22params%22%3A%7B%22userName%22%3A%22admin%22%2C%22password%22%3A%226QNMIQGe%22%2C%22clientType%22%3A%22Dahua3.0-Web3.0-NOTIE%22%2C%22authorityType%22%3A%22OldDigest%22%7D%2C%22id%22%3A10000%7D%3A'
         55        ASSIGN                                                   !1, ~29
   20    56        INIT_FCALL_BY_NAME                                       'curl_setopt'
         57        SEND_VAR_EX                                              !2
         58        FETCH_CONSTANT                                   ~31     'CURLOPT_POSTFIELDS'
         59        SEND_VAL_EX                                              ~31
         60        SEND_VAR_EX                                              !1
         61        DO_FCALL                                      0          
   21    62        INIT_FCALL_BY_NAME                                       'curl_exec'
         63        SEND_VAR_EX                                              !2
         64        DO_FCALL                                      0          
         65        INIT_FCALL_BY_NAME                                       'curl_close'
         66        SEND_VAR_EX                                              !2
         67        DO_FCALL                                      0          
   23    68        ASSIGN                                                   !5, 0
         69      > JMP                                                      ->77
   25    70    >   ROPE_INIT                                     5  ~37     '%3Cimg+src%3D%27http%3A%2F%2F180.211.114.50%3A8011%2Fcgi-bin%2FSnapshot.cgi%3Fchannel%3D'
         71        ROPE_ADD                                      1  ~37     ~37, !5
         72        ROPE_ADD                                      2  ~37     ~37, '%26sessionId%3D'
         73        ROPE_ADD                                      3  ~37     ~37, !4
         74        ROPE_END                                      4  ~36     ~37, '%27+width%3D%27352%27+height%3D%27288%27%3E'
         75        ECHO                                                     ~36
   23    76        PRE_INC                                                  !5
         77    >   IS_SMALLER_OR_EQUAL                                      !5, 15
         78      > JMPNZ                                                    ~41, ->70
   29    79    > > RETURN                                                   1

Function obj2arr:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 15
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/71g1V
function name:  obj2arr
number of ops:  17
compiled vars:  !0 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        TYPE_CHECK                                  256          !0
          2      > JMPZ                                                     ~1, ->7
          3    >   INIT_FCALL                                               'get_object_vars'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        ASSIGN                                                   !0, $2
    4     7    >   TYPE_CHECK                                  128          !0
          8      > JMPZ                                                     ~4, ->15
          9    >   INIT_FCALL                                               'array_map'
         10        SEND_VAL                                                 'obj2arr'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $5      
         13      > RETURN                                                   $5
         14*       JMP                                                      ->16
    5    15    > > RETURN                                                   !0
    6    16*     > RETURN                                                   null

End of function obj2arr

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.54 ms | 1407 KiB | 20 Q