Skip to content

Commit 503dd31

Browse files
committed
use curl instead of file_get_contents
1 parent 6c8cd21 commit 503dd31

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
}
2222
},
2323
"require": {
24-
"ext-ctype": "*"
24+
"ext-ctype": "*",
25+
"ext-curl": "*"
2526
},
2627
"require-dev": {
2728
"phpunit/phpunit": "^8",

src/Client.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,15 @@ private function buildOptions(array $required, array $extra = [])
116116

117117
private function request($path, $options = [])
118118
{
119-
return file_get_contents(self::BASE_URI . "/" . $path . "?" . http_build_query($options));
119+
$curl_get_contents = function ($url) {
120+
$ch = curl_init();
121+
curl_setopt($ch, CURLOPT_URL, $url);
122+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
123+
$output = curl_exec($ch);
124+
curl_close($ch);
125+
return $output;
126+
};
127+
128+
return $curl_get_contents(self::BASE_URI . "/" . $path . "?" . http_build_query($options));
120129
}
121130
}

0 commit comments

Comments
 (0)