PHP Script To Demonstrate Current Users API Usage

Sign up FREE & get 250 points


<?php

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

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

// 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 URL and pass it to the browser
$current_users = 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();
}


// decode the JSON
$current_users_list = json_decode($current_users);

// at this point, $current_users_list will contain objects consisting of user fields
Login with your social network:
Log in with your account:



Shoutbox