I just downloaded the TBA API and placed it on my server. I thought that the API would work pretty much right out of the box, but I can’t get it to work. I inserted my API Key and changed the team number to reflect my team. I checked that php5 is installed on the server. The “Team History” (api_team_history.php) script seems to be working, but it’s not pulling any data. In fact, it doesn’t seem to be pulling any of the information it needs from the API client file(tba_api_client_PHP5.php).
Here’s the page I set up to test the API. http://delphielite.com/tba.php
This page is strictly the Team History code placed inside of an HTML page. Nothing special. All I get is a few of the echos from the team history page but no real information.
Can anyone help me get this working.
I just set up my own install, and things work fine. I suspect your API key is failing to authenticate somehow.
In tba_api_client_PHP5.php, did you change $api_key = “”; //replace with your API key]] to be your API key in quotes? If you left the quotes out, your api key will be “0”, which isn’t going to work.
when trying to echo the API key, nothing is returned. Not even a value of zero.
I did place the API key inside the quotes. This is why I’m so confused. It’s like the client page isn’t being included, but I see no reason for it not to be.
I find that really baffling. I don’t see why your include would fail.
Try echoing something else from the main library?
Could there be something wrong with the chmodding of files that would make them not include?
Well, it seems that the reason I couldn’t echo the api_key is because it was enclosed in the tba_send_request function. Once I brought it out, I was able to echo the key.
I don’t know too much about functions, so I’m wondering how you call one of these functions in your code. Does it just execute, or do you have to call it?
Where do you specify
$method
in
function tba_send_request($method, $arguments=array())
?
I’m just a beginner in PHP, so please bear with me. This is all the original code, except for the addition of the api key and the team number. I started to toy with echo statements after it wouldn’t work and I have since then removed those.
I’ve chmodded the files to 777. No change.
You shouldn’t directly call tba_send_request, this is a sort of “private” helper function. Instead, you call make_array(), get_events(), get_matches(), etc. These functions are the ones that call tba_send_request, and they fill in $method.
You’re sure that PHP is installed correctly? You could try this short script to make sure…if PHP is installed okay it will return a web page with information about your PHP/system configuration. If PHP is installed correctly, all you should have to do is fill in your API key, and put both files in the same directory on your web server and then view api_team_history.php with a web browser.
<?php
phpinfo();
?>
Hope this helps…
PHP is working fine on the site. In fact, most of our site is in PHP.
Does PHP need to be configured any certain way? I believe safe mode is turned on by default.