This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function traceTest(SplFixedArray $arr, string $str, int $num) | |
{ | |
print '----- Before variables changed -----' . PHP_EOL; | |
$e = new RuntimeException(); | |
print $e->getTraceAsString() . PHP_EOL; | |
debug_print_backtrace(); | |
print PHP_EOL; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Possibly related: | |
// https://wiki.php.net/rfc/custom_object_serialization (Problems with existing custom object serialization mechanism) | |
// https://bugs.php.net/bug.php?id=76632 | |
// https://bugs.php.net/bug.php?id=66052 | |
// https://externals.io/message/98834 | |
class ABase implements Serializable | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# Download text file from https://haveibeenpwned.com/Passwords | |
/** Password SHA1 searches */ | |
class PasswordSha1Search | |
{ | |
/** Line Size (sha1 + \r\n) */ | |
const RECORD_SIZE = 42; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rest-client' | |
require 'json' | |
opts = {} | |
api_url = 'https://www.redline13.com/Api' | |
redline_key = 'REDACTED' | |
redline = RestClient::Resource.new( | |
"#{api_url}", | |
'headers' => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('API_ENDPOINT', 'https://www.redline13.com/Api/'); | |
define('API_AUTH_KEY', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'); | |
define('RUN_SIMPLE_LOAD_TEST', true); | |
// Build POST | |
$post = array( | |
'testType' => 'simple', | |
'name' => 'Simple Test With Name Via API', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('API_ENDPOINT', 'https://www.redline13.com/Api/'); | |
define('API_AUTH_KEY', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'); | |
// Make request | |
$ch = curl_init(); | |
curl_setopt_array($ch, array( | |
CURLOPT_RETURNTRANSFER => 1, | |
CURLOPT_URL => API_ENDPOINT . 'StatsDownloadUrls?loadTestId=123', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This example is for writing a Custom PHP Load Test on redline13.com that might need to pick a random E-mail or other data. | |
* If placed inside of the CustomTest constructor, you can download a list of E-mails and randomly pick one to use for the test. | |
* The initial locking part ensures that the file is only downloaded once. | |
* This approach can be used to download other types of files that might be needed as well. | |
* For example, if you need to test uploading files, this can be used to download the files that you will be uploading in your test. | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Build multipart/form-data | |
* | |
* @param array @$data Data | |
* @param array @$files 1-D array of files where key is field name and value if file contents | |
* @param string &$contentType Retun variable for content type | |
* | |
* @return string Encoded data | |
*/ | |
function buildMultipartFormData(array &$data, array &$files, &$contentType) |