Created
November 16, 2021 14:48
-
-
Save steven7mwesigwa/9d638fb98f294b35b1f3f1159c7af75c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$curl = curl_init(); | |
curl_setopt_array($curl, array( | |
CURLOPT_URL => 'https://bitbucket.org/api/2.0/repositories/test7_wanchai/test-indent/diffstat/0a97dd98..2e39c147', | |
CURLOPT_RETURNTRANSFER => true, | |
CURLOPT_ENCODING => '', | |
CURLOPT_MAXREDIRS => 10, | |
CURLOPT_TIMEOUT => 0, | |
CURLOPT_FOLLOWLOCATION => false, | |
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, | |
CURLOPT_CUSTOMREQUEST => 'GET', | |
CURLOPT_USERPWD => 'test7_wanchai:nRa2j7LLt7au7uJMLzcT', | |
)); | |
$response = curl_exec($curl); | |
$http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE); | |
$curl_error = curl_error($curl); | |
curl_close($curl); | |
if ($http_code != 200) { | |
echo "error code : ' . $http_code . ' - cURL error: ' . $curl_error"; | |
} else { | |
echo $response; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment