Skip to content

Instantly share code, notes, and snippets.

@chobie
Created May 14, 2014 18:28
Show Gist options
  • Save chobie/5f4728121543b8c2f475 to your computer and use it in GitHub Desktop.
Save chobie/5f4728121543b8c2f475 to your computer and use it in GitHub Desktop.
function mail_qa_team($data, $compression, $status = false)
{
$url_bits = parse_url(QA_SUBMISSION_PAGE);
if (($proxy = getenv('http_proxy'))) {
$proxy = parse_url($proxy);
$path = $url_bits['host'].$url_bits['path'];
$host = $proxy['host'];
if (empty($proxy['port'])) {
$proxy['port'] = 80;
}
$port = $proxy['port'];
} else {
$path = $url_bits['path'];
$host = $url_bits['host'];
$port = empty($url_bits['port']) ? 80 : $port = $url_bits['port'];
}
$data = "php_test_data=" . urlencode(base64_encode(str_replace("\00", '[0x0]', $data)));
$data_length = strlen($data);
$fs = fsockopen($host, $port, $errno, $errstr, 10);
if (!$fs) {
return false;
}
$php_version = urlencode(TESTED_PHP_VERSION);
echo "\nPosting to ". QA_SUBMISSION_PAGE . "\n";
fwrite($fs, "POST " . $path . "?status=$status&version=$php_version HTTP/1.1\r\n");
fwrite($fs, "Host: " . $host . "\r\n");
fwrite($fs, "User-Agent: QA Browser 0.1\r\n");
fwrite($fs, "Content-Type: application/x-www-form-urlencoded\r\n");
fwrite($fs, "Content-Length: " . $data_length . "\r\n\r\n");
fwrite($fs, $data);
fwrite($fs, "\r\n\r\n");
fclose($fs);
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment