Bitbucket Api call on private repository working for local machine but not from remote server

Jeffrey Witt February 4, 2013

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.

2 answers

0 votes
Jeffrey Witt February 4, 2013

I have received the following response from hosting company:

Unfortunately, BitBucket is not supported on our servers as it requires ffmpeg (which is not supported).

I don't understand how supporting "ffmpeg" could be relevant to api requests and authorization at issue.

Does that response make sense to anyone?

0 votes
aMarcus
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 4, 2013

To be clear, we don't block IP addresses unless there is some severe abuse. There is likely a configuration problem with the server. I'll leave that to the community to help troubleshoot.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events