Skip to content

Instantly share code, notes, and snippets.

@ncrash
Created April 3, 2019 08:29
Show Gist options
  • Save ncrash/96f514e9107858bf718985c996ecdf24 to your computer and use it in GitHub Desktop.
Save ncrash/96f514e9107858bf718985c996ecdf24 to your computer and use it in GitHub Desktop.
#!/usr/bin/env php
<?php
$url = $argv[1];
$bytes = $argv[2];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Junk: ' . bin2hex(openssl_random_pseudo_bytes($bytes / 2)),
]);
$response = curl_exec($ch);
$info = curl_getinfo($ch);
echo 'Response Code: ' . $info['http_code'] . PHP_EOL;
curl_close($ch);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment