Last active
June 6, 2023 20:22
-
-
Save azcoov/7834161 to your computer and use it in GitHub Desktop.
Example of calling the Nearby Now Content Display API with PHP. View the "Content Display API for Site Integration" page in the knowledge base for more examples.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Base endpoint for all API calls | |
$endpoint = "https://api.sidebox.com/plugin"; | |
//The resouce is the API Endpoint you'll be making a web request to | |
$resource = "/heatmap"; | |
//$resource = "/nationwideserviceareareviewcombo"; | |
//$resource = "/testimonials"; | |
//$resource = "/photogallery"; | |
//$resource = "/googlereviews"; | |
//$resource = "/faq"; | |
//required API param | |
$token = "get the Storefront API Token from the Nearby Now admin site"; | |
//optional API params | |
$agent = urlencode($_SERVER['HTTP_USER_AGENT']); | |
$state = ""; // The abbreviated state. For example, Arizona should be "AZ" | |
$city = urlencode(""); | |
$showMap = ""; | |
$showFavorites = ""; | |
$start = ""; | |
$count = ""; | |
$zoom = ""; | |
$reviewCityUrl = ""; | |
$mapSize = ""; | |
$mapScrollWheel = ""; | |
$fbLike = ""; | |
$fbComment = ""; | |
//Optinal params for the heatmap resource | |
$techEmail = urlencode(""); | |
$reviewStart = ""; | |
$checkinStart = ""; | |
$reviewCount = ""; | |
$checkinCount = ""; | |
//View the "Content Display API for Site Integration" page in the knowledge base for a full list of all available params | |
//Optinal params for the Regional & Nation-wide Combination (beta) | |
$lat = ""; | |
$long = ""; | |
$reviewpinmax = ""; | |
$cluster = ""; | |
//Required params for the audio testimonials | |
$playlist = urlencode(""); | |
//Optinal params for the Nearby Service Area Seview Combo resource | |
$showTranscription = ""; | |
$referrer = $_SERVER['HTTP_REFERER']; | |
$hostUrl = "http" . (($_SERVER['SERVER_PORT'] == 443) ? "s://" : "://") . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// /nearbyreviews example params | |
$query = "?storefronttoken=$token&state=$state&city=$city&zoomlevel=$zoom&start=$start&count=$count&showmap=$showMap&mapsize=$mapSize&mapscrollwheel=$mapScrollWheel&fblike=$fbLike&fbcomment=$fbComment&showfavorites=$showFavorites&agent=$agent&referrer=$referrer&hosturl=$hostUrl"; | |
// /nearbyservicearea example params | |
//$query = "?storefronttoken=$token&state=$state&city=$city&zoomlevel=$zoom&start=$start&count=$count&showmap=$showMap&mapsize=$mapSize&mapscrollwheel=$mapScrollWheel&fblike=$fbLike&fbcomment=$fbComment&showfavorites=$showFavorites&agent=$agent"; | |
// /nearbyserviceareareviewcombo example params | |
//$query = "?storefronttoken=$token&state=$state&city=$city&zoomlevel=$zoom&reviewcityurl=$reviewCityUrl&reviewstart=$reviewStart&checkinstart=$checkinStart&reviewcount=$reviewCount&checkincount=$checkinCount&showmap=$showMap&mapsize=$mapSize&mapscrollwheel=$mapScrollWheel&fblike=$fbLike&fbcomment=$fbComment&showfavorites=$showFavorites&agent=$agent"; | |
// /nationwideserviceareareviewcombo example params | |
//$query = "?storefronttoken=$token&state=$state&zoomlevel=$zoom&mapsize=$mapSize&lat=$lat&long=$long&reviewpinmax=$reviewpinmax&cluster=$cluster&agent=$agent"; | |
// /photogallery example params | |
//$query = "?storefronttoken=$token&start=$start&count=$count&agent=$agent"; | |
// /testimonials example params | |
//$query = "?storefronttoken=$token&start=$start&count=$count&playlist=$playlist&showTranscription=$showTranscription&agent=$agent"; | |
$url = "$endpoint$resource$query"; | |
$response = file_get_contents($url); | |
echo $response; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment