Compare commits

...

5 Commits

Author SHA1 Message Date
Jean-Baptiste Nahan
251cd72e6e add debug info 2024-11-13 10:55:08 +01:00
Jean-Baptiste Nahan
bdec9f92b9 add var_dump on set headers 2024-11-13 10:35:41 +01:00
Jean-Baptiste Nahan
154b63fb2e add log for http call 2024-11-13 09:11:12 +01:00
Jean-Baptiste Nahan
b9530450e2 try other header 2024-11-13 00:03:24 +01:00
Jean-Baptiste Nahan
c74c3b5b94 add log 2024-11-12 23:12:24 +01:00

View File

@@ -122,6 +122,8 @@ trait FileOps
retry:
$ch = curl_init();
echo "CALL $url \n";
curl_setopt($ch, CURLOPT_URL, $url);
if ($dest_fn) {
@@ -131,22 +133,27 @@ retry:
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
}
curl_setopt($ch, CURLOPT_HEADER, false);
//curl_setopt($ch, CURLOPT_HEADER, false);
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)) {
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer '.$token]);
echo "**** define authorization header ! ****\n";
var_dump(curl_setopt($ch, CURLOPT_HTTPHEADER, ['Accept: text/plain','X-custom-header: top1','Authorization: Bearer '.$token]));
}
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) {