Ciao a tutti ho un problema nell'eseguire il parsing di un Array in php.
Via allego il codice PHP e l'estratto Array:
**PHP:
[PHP]
$url = "https://vulners.com/api/v3/audit/audit/?os=redhat&version=7.1&package=redhat-release-server-7.2-9.el7.x86_64";
$cURL = curl_init();
curl_setopt($cURL, CURLOPT_URL, $url); curl_setopt($cURL, CURLOPT_HTTPGET, true); curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($cURL); curl_close($cURL);
$jsonData = json_decode($result, true);
foreach ($jsonData as $valore) { echo $valore['package']; echo '<pre>'; var_dump($item); }
[/PHP]
Array:
**```
Array( [result] => OK [data] => Array ( [packages] => Array ( [redhat-release-server-7.2-9.el7.x86_64] => Array ( [RHSA-2017:3108] => Array ( [0] => Array ( [package] => redhat-release-server-7.2-9.el7.x86_64 [providedVersion] => 0:7.2-9.el7 [bulletinVersion] => 7.2-9.el7_2.3 [providedPackage] => redhat-release-server-7.2-9.el7.x86_64 [bulletinPackage] => redhat-release-server-7.2-9.el7_2.3.x86_64.rpm [operator] => lt [bulletinID] => RHSA-2017:3108 [cvelist] => Array ( ) [fix] => sudo yum -y update redhat-release-server ) ) [RHSA-2017:1384] => Array ( [0] => Array ( [package] => redhat-release-server-7.2-9.el7.x86_64 [providedVersion] => 0:7.2-9.el7 [bulletinVersion] => 7.2-9.el7_2.2 [providedPackage] => redhat-release-server-7.2-9.el7.x86_64 [bulletinPackage] => redhat-release-server-7.2-9.el7_2.2.x86_64.rpm [operator] => lt [bulletinID] => RHSA-2017:1384 [cvelist] => Array ( ) [fix] => sudo yum -y update redhat-release-server ) ) ) ) [vulnerabilities] => Array ( [0] => RHSA-2017:3108 [1] => RHSA-2017:1384 ) [reasons] => Array ( [0] => Array ( [package] => redhat-release-server-7.2-9.el7.x86_64 [providedVersion] => 0:7.2-9.el7 [bulletinVersion] => 7.2-9.el7_2.3 [providedPackage] => redhat-release-server-7.2-9.el7.x86_64 [bulletinPackage] => redhat-release-server-7.2-9.el7_2.3.x86_64.rpm [operator] => lt [bulletinID] => RHSA-2017:3108 [cvelist] => Array ( ) [fix] => sudo yum -y update redhat-release-server ) [1] => Array ( [package] => redhat-release-server-7.2-9.el7.x86_64 [providedVersion] => 0:7.2-9.el7 [bulletinVersion] => 7.2-9.el7_2.2 [providedPackage] => redhat-release-server-7.2-9.el7.x86_64 [bulletinPackage] => redhat-release-server-7.2-9.el7_2.2.x86_64.rpm [operator] => lt [bulletinID] => RHSA-2017:1384 [cvelist] => Array ( ) [fix] => sudo yum -y update redhat-release-server ) ) [cvss] => Array ( [score] => 0 [vector] => NONE ) [cvelist] => Array ( ) [cumulativeFix] => sudo yum -y update redhat-release-server [id] => AZP2HVGJ3L3M6FYL28K4YDNGW8CRN19P49V4Y6X3501J67W1SMSCM9MXNC5DVGWG4X8ON5ZM0RLYK7XB818IHUA6GHL737M2P4VQ250SHLDE2IZUY4F3GATSRQX8XBLX ))
Non mi funziona, dove sbaglio ?
Grazie a tutti.