mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-09-19 14:56:31 +00:00
26 lines
793 B
PHP
26 lines
793 B
PHP
<?php
|
|
class Test {
|
|
const TEST_URL = 'https://127.0.0.1/php-curl-class/tests/server.php';
|
|
|
|
function __construct() {
|
|
$this->curl = new Curl();
|
|
$this->curl->setOpt(CURLOPT_SSL_VERIFYPEER, FALSE);
|
|
$this->curl->setOpt(CURLOPT_SSL_VERIFYHOST, FALSE);
|
|
}
|
|
|
|
function server($request_method, $data='') {
|
|
$request_method = strtolower($request_method);
|
|
$this->curl->$request_method(self::TEST_URL, $data);
|
|
return $this->curl->response;
|
|
}
|
|
}
|
|
|
|
function get_raw_image() {
|
|
// PNG image data, 1 x 1, 1-bit colormap, non-interlaced
|
|
ob_start();
|
|
imagepng(imagecreatefromstring(base64_decode('R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7')));
|
|
$raw_image = ob_get_contents();
|
|
ob_end_clean();
|
|
return $raw_image;
|
|
}
|