Skip to content

Instantly share code, notes, and snippets.

@svjv1160
svjv1160 / betterplace_project_opinions.php
Last active Aug 27, 2018
This snippet shows a simple implementation of Betterplace.org API to display project progress on a custom website. The snippet uses PHP Vers. 5.2.0. and does not contain a CSS layout. For further details see Betterplace.org API: https://github.com/betterplace/betterplace_apidocs
View betterplace_project_opinions.php
<?php
/* Your project ID from Betterplace.org */
$project = 12345;
/* Get positive opinions (max 100) */
$json = file_get_contents('https://api.betterplace.org/en/api_v4/projects/'. $project.'/opinions.json?facets=score:positive&order=created_at:DESC&per_page=100' );
$obj = json_decode($json);
if($obj->total_entries>0) {
echo '<ul class="positive">';