Pages:
Author

Topic: [CLOSED] Bounty 5 BTC - Acessing CampBX API with PHP - page 2. (Read 3184 times)

legendary
Activity: 1498
Merit: 1000
Code:
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; BTChash; '.php_uname('s').'; PHP/'.phpversion().')');

add this to your code, i looked at his source and this how he gets it to work
donator
Activity: 305
Merit: 250
Thanks for the link, but his library doesn't work for me for some reason.
legendary
Activity: 1498
Merit: 1000
https://bitbucket.org/brandonbeasley/campbx-php/overview
the have a library

also you may need to do basic auth to use curl
donator
Activity: 305
Merit: 250
I am surprised nobody has working code for accessing CampBX API with PHP.  Maybe it is just my setup?  Either way, I am going to throw in a 5 BTC bounty to whoever helps me solve this problem.  Please post or PM me.  Thanks.
donator
Activity: 305
Merit: 250
I am actually running this on win server 2008.  I don't see anything in the PHP error log or the IIS error log.  I can access the other exchanges (mtgox, bitfloor, intersango) with no issues.  Weird it is just with CampBX.
BCB
vip
Activity: 1078
Merit: 1002
BCJ
Any output in your apache error_log?
donator
Activity: 305
Merit: 250
Yeah, I have been granted API access.  Interestingly, if I post the credentials through a form, then I can access myfunds, myorders, etc.  But if I try to post the same data with cURL, I get
"Bad Request
Your browser sent a request that this server could not understand.
Additionally, a 400 Bad Request error was encountered while trying to use an ErrorDocument to handle the request."

my cURL parameters:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://CampBX.com/api/myfunds.php');
curl_setopt($ch, CURLOPT_POSTFIELDS, 'user=myUser&pass=myPassword');
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$res = curl_exec($ch);
print_r($res);
curl_close($ch);

if I use file_get_contents, I just get a blank page.



Try:

 $params['user'] = "username";
 $params['pass'] = "password";

 $postData = http_build_query($params, '', '&');

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://CampBX.com/api/myfunds.php');
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$res = curl_exec($ch);
print_r($res);
curl_close($ch);

Thanks for your help, but I got the same response.  "Bad request..."
BCB
vip
Activity: 1078
Merit: 1002
BCJ
Yeah, I have been granted API access.  Interestingly, if I post the credentials through a form, then I can access myfunds, myorders, etc.  But if I try to post the same data with cURL, I get
"Bad Request
Your browser sent a request that this server could not understand.
Additionally, a 400 Bad Request error was encountered while trying to use an ErrorDocument to handle the request."

my cURL parameters:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://CampBX.com/api/myfunds.php');
curl_setopt($ch, CURLOPT_POSTFIELDS, 'user=myUser&pass=myPassword');
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$res = curl_exec($ch);
print_r($res);
curl_close($ch);

if I use file_get_contents, I just get a blank page.



Try:

 $params['user'] = "username";
 $params['pass'] = "password";

 $postData = http_build_query($params, '', '&');

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://CampBX.com/api/myfunds.php');
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$res = curl_exec($ch);
print_r($res);
curl_close($ch);
donator
Activity: 305
Merit: 250
Yeah, I have been granted API access.  Interestingly, if I post the credentials through a form, then I can access myfunds, myorders, etc.  But if I try to post the same data with cURL, I get
"Bad Request
Your browser sent a request that this server could not understand.
Additionally, a 400 Bad Request error was encountered while trying to use an ErrorDocument to handle the request."

my cURL parameters:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://CampBX.com/api/myfunds.php');
curl_setopt($ch, CURLOPT_POSTFIELDS, 'user=myUser&pass=myPassword');
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$res = curl_exec($ch);
print_r($res);
curl_close($ch);

if I use file_get_contents, I just get a blank page.
BCB
vip
Activity: 1078
Merit: 1002
BCJ
Have you requested api credentials access?  You have the request access.  There is no on and off in the user interface.  Then you can use your existing credentials.
donator
Activity: 305
Merit: 250
Does anybody have working code for connecting to the CampBX API with PHP?  I can get market data and account data if I post the auth info through a form, but I can't seem to connect to account data with cURL or file_get_contents in PHP.  The linked PHP library by Brandon Beasley also doesn't work for me for some reason.  Can't get a response from their support either for the last 2 weeks.  If anybody has working code to get account info via cURL or file_get_contents in PHP, I would much appreciate it.  Thanks.

EDIT:  Added 5 BTC bounty for whoever helps me solve this problem.  Thanks.
Pages:
Jump to: