PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php $s = [[122, 2], 3, 4, 5, 6, 7]; $resArray = []; function convertToSimpleArray($array){ global $resArray; if(is_array($array)){ foreach($array as $below){ $res = convertToSimpleArray($below); } }else{ $resArray[] = $array; } return $resArray; } $resArray = convertToSimpleArray($s); print_r($resArray); $torgi_in_b24 = []; foreach($resArray as $v){ $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://test.btrx24.vtbc.net/rest/3/6622d2mu04bp1mmf/crm.item.list.json", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => "{\"entityTypeId\": \"172\", \"filter\": {\"title\" : $v, \"ufCrm1_1652534685\" : \"1\"}, \"select\": [\"id\", \"ufCrm1_1652534685\", \"title\"]}", CURLOPT_COOKIE => "BITRIX_SM_SALE_UID=0", CURLOPT_HTTPHEADER => [ "Content-Type: application/json" ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); $Res = (array)json_decode($response); $Result = (array)$Res; $i = json_decode(json_encode($Result), true); array_push($torgi_in_b24, array($i[result][items][0][title] => $i[result][items][0][id])); } print_r($torgi_in_b24);
Show:  
Copy Clear