|
Documentation
This is the documentation for the BIT API Class
IntroductionThis class had made it very simple to make API calls to Bandsintown to receive concert data about artists and related artists. DetailsBIT PHP Library provides the user to make 3 calls to the Bandsintown API engine:
StepsLet's take an example of a simple artist event search using the BIT PHP Library. Step 1. Include the BIT.php in your source include ("BIT.php");Step 2. Create an instance and Set your API key for the Instance. Please note that Bandsintown doesn't have an API Signup process - so you can use any string value for your API key. $myBIT = new BIT();
$myBIT->setAPI("APIKEYHERE");Step 3. Perform the single artist events search API try
{
// set the Artist that you want to search. Make sure you leave it plain text - do not do any URL encoding. The class file will take care of that for you.
$artists = "Angels and Airwaves";
// perform the get Artist function
$results = $myBIT->getEventsForSingleArtist($artists);
// loop through the response
foreach($results as $events)
{
$dateofevent = date("m/d/y H:i", strtotime($events->datetime));
$venue_city = $events->venue->city;
$venue_region = $events->venue->region;
$venue_name = $events->venue->name;
// display the results of the entry
echo $venue_name . " (" . $venue_city . "," . $venue_name . ") on " . $dateofevent . "<br>";
}
}
catch(Exception $e)
{
// If you have an error from the request - it will be displayed here.
echo $e->getMessage();
}
bit-php-library returns an json decoded array of elements that you can parse through using a foreach loop. Please refer to to Bandsintown's API Documentation for the list of json responses. It's that simple! Please refer to the examples.php for more on how you can you perform other calls with this library. DISCLAIMER: This code is open source. That means, in plain English, that I cannot guarantee the effectiveness of the code and that it is production ready. The Product is provided AS-IS and no warranties are in effect. If you encounter any issues - please use the bug tracker and I'll be quick to reply. Thanks for using BIT PHP Library! |
Hey- I'm new to php and having a little trouble getting some of this to work. From what I can tell reading through everything, if I run the examples.php (with BIT.php available in the dir), it should perform the 3 example searches and display the results for the default Angels and Airwaves searches. All I'm getting is the header html text through Example #1 - Artist Search and then nothing else. I run the script with chrome dev tools and don't see any other activity going on. Am I missing something simple that I still need to configure?
I was hoping to have a basic example that displays the results of the json response and then start modifying it for my project from there.
Thanks for putting this together though regardless.