Script used to verify fraudulent installs on PHPixie.
<?php | |
function getJsonPage($url) | |
{ | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
$result = curl_exec($ch); | |
curl_close($ch); | |
return json_decode($result, true); | |
} | |
$baseUrl = 'https://packagist.org/packages/'; | |
$downloads = []; | |
foreach ([ | |
'phpixie/project', | |
'phpixie/orm', | |
'phpixie/config', | |
'symfony/symfony', | |
'laravel/framework', | |
'slim/slim', | |
'zendframework/zend-expressive', | |
] as $package) { | |
$apiUrl = $baseUrl . $package . '.json'; | |
$data = getJsonPage($apiUrl); | |
if (!isset($data['package']) || !isset($data['package']['downloads'])) { | |
continue; | |
} | |
$downloads[$package] = $data['package']['downloads']; | |
} | |
$dumpFile = __DIR__ . '/dump/' . date('Y-m-d-H-i') . '.json'; | |
file_put_contents($dumpFile, json_encode($downloads, JSON_PRETTY_PRINT)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment