i looked everywhere but couldnt find a solution... how do i parse discogs bbcode and convert it to html, or just strip it out ?
api is returning band biographys with lot of non-standard bbcode and discogs internal link... how can i parse it to human-readable text ready to be displayed to end user on my website ?
i asked in discogs forum and got this answer:
If you don't want that specific format, you can include an Accept header in your response with your preferred response type. We currently offer Discogs format (what you've got now), plaintext (URLs and other formatting is just stripped away), and HTML. For more information, see the API docs: https://www.discogs.com/developers/#page:home,header:home-versioning-and-media-types
So i tried this but it didn't work:
curl_setopt($ch, CURLOPT_HTTPHEADER, array('application/vnd.discogs.v2.html+json'));
here's what i have so far
$ch = curl_init(); //initialize the session
curl_setopt($ch, CURLOPT_USERAGENT, 'APN/1.0 +https://www.anarcho-punk.net'); //Set the User-Agent Identifier
curl_setopt($ch, CURLOPT_URL, $discogs_label_apiurl); //Set the URL of the page or file to download.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Ask cURL to return the contents in a variable instead of simply echoing them
//curl_setopt($ch, CURLOPT_HTTPHEADER, array('application/vnd.discogs.v2.html+json'));
// curl_setopt($ch, CURLOPT_HTTPHEADER, array('ACCEPT' => 'application/vnd.discogs.v2.html+json'));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('ACCEPT' => 'text/html'));
$output = curl_exec($ch);