PHP Yipit API Code

PHP Yipit API Code

If you are familiar with Yipit.com you will find one of the biggest and most successful daily deal aggregators in the US. What a lot of people don’t realize is that Yipit has a wonder API that allows other wannabe aggregators the opportunity to post great daily deal content from over 600 daily deal sites in 75 cities.

Why would you want to use their API?

Because they also allow you to sign up for daily deal affiliate programs and earn affiliate commissions while using their API. Currently there are only 15 affiliate programs that you can sign up for however those do include Groupon and Living Social the top 2 daily deal sites in the business.

So if you are interested in using their API you will need to sign up and get approval at Yipit. Once approved you will receive an API key that will give you access to the API. You can use specific tags to query the JSON formatted details of each offer.

Below is php example of how you can query such JSON calls to build your daily deals page. The code below only queries deals in Indianapolis. However you can easily update it to make the script work for you.

<?
$key = ‘your api key’;
$search = “http://api.yipit.com/v1/deals/?key=$key&division=indianapolis”;     
$search_init = curl_init();
curl_setopt($search_init, CURLOPT_HTTPHEADER, array( ‘Expect:’ ) );
curl_setopt($search_init, CURLOPT_URL, $search);
curl_setopt($search_init, CURLOPT_RETURNTRANSFER, TRUE);
$yipit = curl_exec($search_init);
$obj = json_decode($yipit,true);
$cnt=count($obj["response"]["deals"]);
for($i=0;$i<$cnt;$i++)
{

echo “<p>ID: “.$obj["response"]["deals"][$i]["id"].”<br>Date Added: “.$obj["response"]["deals"][$i]["date_added"].”<br>End Date: “.$obj["response"]["deals"][$i]["end_date"].”<br>Discount formatted: “.$obj["response"]["deals"][$i]["discount"]["formatted"].”<br>Price formatted: “.$obj["response"]["deals"][$i]["price"]["formatted"].”<br>Value formatted: “.$obj["response"]["deals"][$i]["value"]["formatted"].”<br>Purchased: “.$obj["response"]["deals"][$i]["purchased"].”<br>Yipit title: “.$obj["response"]["deals"][$i]["yipit_title"].”<br>Url: “. $obj["response"]["deals"][$i]["url"].”<br>Yipit url: “.$obj["response"]["deals"][$i]["yipit_url"].”<br>Mobile url: “.$obj["response"]["deals"][$i]["mobile_url"].”<br>Image big: “.$obj["response"]["deals"][$i]["images"]["image_big"].”<br>Image small: “.$obj["response"]["deals"][$i]["images"]["image_small"].”<br>Tag name: “.$obj["response"]["deals"][$i]["tags"][0]["name"].”<br>Tag slug: “.$obj["response"]["deals"][$i]["tags"][0]["slug"].”<br>Tag url: “.$obj["response"]["deals"][$i]["tags"][0]["url"].”<br>Business name: “.$obj["response"]["deals"][$i]["business"]["name"].”<br>Source name: “.$obj["response"]["deals"][$i]["source"]["name"].”</p>”;
}
?>

Submit a Comment

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>