Skip to content

Instantly share code, notes, and snippets.

@steven7mwesigwa
Created November 16, 2021 14:44
Show Gist options
  • Save steven7mwesigwa/c0bd9a5624349ac7d25d22c866ab3ace to your computer and use it in GitHub Desktop.
Save steven7mwesigwa/c0bd9a5624349ac7d25d22c866ab3ace to your computer and use it in GitHub Desktop.
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://bitbucket.org/!api/2.0/repositories/test7_wanchai/test-indent/src/0a97dd980bd80b68270bbe64bbf1fc30fd409c33/dummy-100.txt',
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