mirror of
https://github.com/php-win-ext/php-sdk-binary-tools.git
synced 2026-03-24 09:02:12 +01:00
Compare commits
6 Commits
php-sdk-2.
...
php-sdk-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa22e335c8 | ||
|
|
52b83f957e | ||
|
|
251cd72e6e | ||
|
|
bdec9f92b9 | ||
|
|
154b63fb2e | ||
|
|
b9530450e2 |
@@ -122,6 +122,8 @@ trait FileOps
|
||||
retry:
|
||||
$ch = curl_init();
|
||||
|
||||
echo "CALL $url \n";
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
|
||||
if ($dest_fn) {
|
||||
@@ -131,23 +133,30 @@ retry:
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
}
|
||||
|
||||
curl_setopt($ch, CURLOPT_HEADER, false);
|
||||
curl_setopt($ch, CURLOPT_HEADER, true);
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, Config::getSdkUserAgentName());
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
|
||||
curl_setopt($ch, CURLOPT_VERBOSE, 1);
|
||||
|
||||
$token = getenv('API_TOKEN');
|
||||
if (!empty($token)) {
|
||||
echo "**** define authorization header ! ****\n";
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer '.$token]);
|
||||
var_dump(curl_setopt($ch, CURLOPT_HTTPHEADER, ['Accept: text/plain','X-custom-header: top1','Authorization: Bearer '.$token]));
|
||||
}
|
||||
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, 'test');
|
||||
//curl_setopt($ch, CURLOPT_USERAGENT, Config::getSdkUserAgentName());
|
||||
|
||||
echo "curl_error=". curl_error($ch) ."\n";
|
||||
|
||||
|
||||
// workaround for <https://github.com/microsoft/php-sdk-binary-tools/issues/69>
|
||||
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
|
||||
|
||||
$ret = curl_exec($ch);
|
||||
var_dump($ret);
|
||||
|
||||
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
if (false === $ret || 200 !== $code) {
|
||||
|
||||
Reference in New Issue
Block a user