|
I have a strange problem. I have some code (PHP) that requests information from a private repository using BitBucket's API. When I make the request from localhost (my local server – apache2) I have no problem.
However, when I make the same request from my remote server (I.e. My live website I get a 403 forbidden).
I'm not sure why it's working in one place and not in another.
Therefore, I was wondering if requests from the ip address of my remote server are somehow being blocked or if that ip address has been whitelisted for some reason.
The code (which, again works fine from my localhost) is pasted below:
function bitBucketConnect($url){
global $bitPassword;
global $bitUsername;
$context = stream_context_create(array
( 'http' => array(
'header' => "Authorization: Basic " . base64_encode("$bitUsername:$bitPassword") ))
);
//Make the request
return file_get_contents($url, false, $context);
}
I can further report that, when the bitBucket repository is PUBLIC/NOT PRIVATE this will successfully retrieve data on the remote server. But the whole point of using the authorization header is to be able to access a private repository. And this is where I get the 403 Forbidden response. (But again, on my local machine, I have sucess when the Repo is either public or private).
I very much appreciate any assistance you can give me.
|