Test run for Curl URL Requests
This commit is contained in:
@@ -117,6 +117,7 @@ $test_files = [
|
||||
'class_test.config.direct.php' => 'Class Test: CONFIG DIRECT',
|
||||
'class_test.class-calls.php' => 'Class Test: CLASS CALLS',
|
||||
'class_test.error_msg.php' => 'Class Test: ERROR MSG',
|
||||
'class_test.url-requests.curl.php' => 'Class Test: URL REQUESTS: CURL',
|
||||
'subfolder/class_test.config.direct.php' => 'Class Test: CONFIG DIRECT SUB',
|
||||
];
|
||||
|
||||
|
||||
@@ -39,6 +39,10 @@ $url = 'https://soba.egplusww.jp';
|
||||
|
||||
$data = $client->requestGet($url, []);
|
||||
|
||||
print "<hr>";
|
||||
print "RESPONSE: <pre>" . print_r($data, true) . "</pre>";
|
||||
print "<hr>";
|
||||
|
||||
print "</body></html>";
|
||||
|
||||
// __END__
|
||||
@@ -139,9 +139,7 @@ class Curl implements Interface\RequestsInterface
|
||||
// init curl handle
|
||||
$handle = $this->handleCurleInit($url);
|
||||
// set the standard curl options
|
||||
if ($headers !== []) {
|
||||
$this->setCurlOptions($handle, $headers);
|
||||
}
|
||||
$this->setCurlOptions($handle, $headers);
|
||||
// for post we set POST option
|
||||
if ($type == "post") {
|
||||
curl_setopt($handle, CURLOPT_POST, true);
|
||||
@@ -205,7 +203,9 @@ class Curl implements Interface\RequestsInterface
|
||||
if (!empty($this->auth_ident)) {
|
||||
curl_setopt($handle, CURLOPT_USERPWD, $this->auth_ident);
|
||||
}
|
||||
curl_setopt($handle, CURLOPT_HTTPHEADER, $headers);
|
||||
if ($headers !== []) {
|
||||
curl_setopt($handle, CURLOPT_HTTPHEADER, $headers);
|
||||
}
|
||||
// curl_setopt($handle, CURLOPT_FAILONERROR, true);
|
||||
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
|
||||
// for debug only
|
||||
|
||||
Reference in New Issue
Block a user