Miscellaneous ·

Advertising Using the Tenping API

I saw a Tenping ad on Facebook, so I’m trying it out by writing some PHP.

Looking at the revenue rankings on the Tenping site, I wonder whether it can really be run for long considering the overall sales ;;

If the results look good after testing, I’ll write about various ways to use Tenping (such as optimizing click-through rates).

(* I’ll share the source only with people who have registered me as their senior, haha.)

Anyway, here’s an example of displaying ads using the Tenping API.

  1. Sign up for Tenping
  2. Visit “http://tenping.kr/API”
  3. Copy “Request URL” from “API Guide”
  4. Paste it where you’ll use the source below
  5. Display the result using the $tenping value
<?php

$cache_file = './data/list.json'; // Cache file location
$cache_time = 1800; // Cache duration

if(is_file($cache_file))
{
$data = file_get_contents($cache_file);

if(time()-filemtime($cache_file)>$cache_time = 1800) $data = '';
}

if(!$data)
{
// Enter the Request URL copied from the API.
// CampaignType is the sum of the desired types selected below.
// (1:CPC+5, 2:CPA, 4:CPS, 8:CPI, 32:CPV, 64:CPADB, 128:CPC)
$url = 'http://tenping.kr/adbox/list?MemberID=?!?!?!?!?!?!?&CampaignType=129&MinClickPoint=30&MinCurrentPoint=1000';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
curl_close($ch);

file_put_contents($cache_file, $data);
}

$json = json_decode($data, true);

if($json['ResultCode'] == '200')
{
$tenping = $json['List'][mt_rand(0, count($json['List'])-1)];
}

// Output and use the $tenping value.

?>

* If you haven’t registered a senior when using the API, you can’t check the unit price or remaining inventory (ClickPoint, CurrentPoint) for Tenping content.
Please register me as your senior at prince@kilho.net, then email me the last four digits of your phone number so I can identify your registration.
I’ll send you any Tenping-related information that comes up in the future ^^

1 Comment

  1. 쿠키죠

    안녕하세요 글은 잘보았습니다
    혹시 어떻게 적용해야하는지 자세히 글 작성가능하신지 여쭈어봅니다..
    텐핑 api관련해서는 글이 많이없어 부탁드립니다ㅠ

Leave a Reply

Your email address will not be published. Required fields are marked *