SponsorPay API in PHP


Hits: 4005  

SponsorPay – International Leader in Engagement Marketing and Performance Advertising for the Monetization of Virtual Currency and Digital Content on Social Networks, Online Games, Virtual Worlds and Entertainment Platforms.

Mobile Developers - SponsorPay
Mobile Developers – SponsorPay

Key Features:

* Boost branding and engagement
* Acquire users and improve engagement
* Engage and monetize all your users
* Drive customer acquisition and sales
* Grow revenues with innovative products
* Achieve true glocal monetization

SponsorPay Products

* Offer Wall
* Layover Offer Wall
* Offer Banners
* Offer Bar
* Offer Widget
* BrandEngage

SponsorPay Mobile Offer API

JSON Format
http://api.sponsorpay.com/feed/v1/offers.json?appid=[APP_ID]&uid=[USER_ID]&ip=[IP_ADDRESS]&locale=[LOCALE]&device_id=[DEVICE_ID]&ps_time=[TIMESTAMP]&pub0=[CUSTOM]&timestamp=[UNIX_TIMESTAMP]&offer_types=[OFFER_TYPES]&android_id=[ANDROID_ID]&hashkey=[HASHKEY]

XML Format
http://api.sponsorpay.com/feed/v1/offers.xml?appid=[APP_ID]&uid=[USER_ID]&ip=[IP_ADDRESS]&locale=[LOCALE]&device_id=[DEVICE_ID]&ps_time=[TIMESTAMP]&pub0=[CUSTOM]&timestamp=[UNIX_TIMESTAMP]&offer_types=[OFFER_TYPES]&android_id=[ANDROID_ID]&hashkey=[HASHKEY]

<?php

// Step 1: Gather all request parameters

$page = isset($_REQUEST['page'])?$_REQUEST['page']:"1";
$uid = isset($_REQUEST['uid'])?$_REQUEST['uid']:"svnlabs";
$pub0 = isset($_REQUEST['pub0'])?$_REQUEST['pub0']:"sv";
$appid = isset($_REQUEST['appid'])?$_REQUEST['appid']:"APP-ID";
$device_id = isset($_REQUEST['device_id'])?$_REQUEST['device_id']:"DEVICE-ID";
$ip = isset($_REQUEST['ip'])?$_REQUEST['ip']:"IP-ADDRESS";
$apikey = isset($_REQUEST['apikey'])?$_REQUEST['apikey']:"API-KEY";
$format = isset($_REQUEST['format'])?$_REQUEST['format']:"json";

$requestring = 'http://api.sponsorpay.com/feed/v1/offers.'.$format.'?';

$d = array(   
        'appid' => $appid,
        'device_id' => $device_id,
        'ip' => $ip,
        'locale' => 'en',
        'page' => $page,
        'pub0' => $pub0,
        'timestamp' => time(),
        'uid' => $uid,
    );
    
    
//Step 2: Order all request alphabetically    
    
ksort($d);

//Step 3: Concatenate all request parameters

$params = '';

foreach($d as $k=>$v)
{
  $params .= $k."=".$v."&"; 
}    

//Step 4: Concatenate the resulting string with your API Key
//Step 5: Hash the resulting string using SHA1

$hash = sha1($params.$apikey);

$url = $requestring.$params."hashkey=".$hash;

echo file_get_contents($url);

?>

 

SponsorPay is a really good solution for social media platform using more engaging ad units than traditional social media formats.

Published by

Sandeep Verma

I’m an Entrepreneur. I’m proud to work as Blogger, LAMP Programmer, Linux Admin, Web Consultant, Cloud Manager, Apps Developer, Searcher. Concentrate > Observe > Imagine > Launch