PHP Script To Demonstrate Shoutbox API Usage

Sign up FREE & get 250 points


<?php
// create a new cURL resource
$ch = curl_init();
$url = 'http://www.points2shop.com/webservice/shoutbox';

// This key is required for all API REST calls and can be found in details of your application 
$key = '6586df0367b681497ef77437f0c71c10ae38302e';

// set URL and HTTP header options
$options = array(CURLOPT_URL => $url,
                 CURLOPT_RETURNTRANSFER => 1,
                 CURLOPT_HTTPHEADER => array('X-Points2shop-Api-Key: ' . $key)
                 );
// Notice the space after 'Api-Key: '
curl_setopt_array($ch, $options);

// grab contents from the URL and pass it to the browser
$shoutbox = curl_exec($ch);
# Check whether the response was valid
$curl_info = curl_getinfo($ch);
if ($curl_info['http_code'] != 200) {
    echo "Unable to obtain information";
    exit();
}

$shoutbox_array = json_decode($shoutbox);
// at this point, $shoutbox_array contains arrays consisting of shoutbox fields

Back to REST API Usage

Login with your social network:
Log in with your account: