コード例 #1
0
ファイル: index.php プロジェクト: ananthuma/flipazon
<?php 
error_reporting(0);
if ("cli" !== PHP_SAPI) {
    echo "<pre>";
}
if (is_file('sampleSettings.php')) {
    include 'sampleSettings.php';
}
defined('AWS_API_KEY') or define('AWS_API_KEY', 'AKIAJ3SXK26ABGUYBAUA');
defined('AWS_API_SECRET_KEY') or define('AWS_API_SECRET_KEY', 'nSjL1iMFZFVVu2jnwW0zT0wxw3t79hsWUEbYbVsr');
defined('AWS_ASSOCIATE_TAG') or define('AWS_ASSOCIATE_TAG', 'productcompar-21');
require '/lib/AmazonECS.class.php';
//Include the class.
include "clusterdev.flipkart-api.php";
//Replace <affiliate-id> and <access-token> with the correct values
$flipkart = new \clusterdev\Flipkart("<affiliate-id>", "<access-token>", "json");
$query = $_POST["name"];
$query2 = str_replace(' ', '+', $query);
$dotd_url = 'https://affiliate-api.flipkart.net/affiliate/search/json?query=' . $query2 . '&resultCount=9';
//Call the API using the URL.
$details = $flipkart->call_url($dotd_url);
if (!$details) {
    echo 'Error: Could not retrieve products list.';
    exit;
}
//The response is expected to be JSON. Decode it into associative arrays.
$details = json_decode($details, TRUE);
$products = $details['productInfoList'];
echo "<table border=2 cellpadding=10 cellspacing=1 style='text-align:center'>";
$count = 0;
$end = 1;
コード例 #2
0
/**
 * Demo Code
 * PHP Wrapper for Flipkart API (unofficial)
 * GitHub: https://github.com/xaneem/flipkart-api-php
 * Demo: http://www.clusterdev.com/flipkart-api-demo
 * License: MIT License
 *
 * @author Saneem (@xaneem, xaneem@gmail.com)
 */
//This is basic example code, and is not intended to be used in production.
//Don't forget to use a valid Affiliate Id and Access Token.
//Include the class.
include "clusterdev.flipkart-api.php";
//Replace <affiliate-id> and <access-token> with the correct values
$flipkart = new \clusterdev\Flipkart("<affiliate-id>", "<access-token>", "json");
$dotd_url = 'https://affiliate-api.flipkart.net/affiliate/offers/v1/dotd/json';
$topoffers_url = 'https://affiliate-api.flipkart.net/affiliate/offers/v1/top/json';
//To view category pages, API URL is passed as query string.
$url = isset($_GET['url']) ? $_GET['url'] : false;
if ($url) {
    //URL is base64 encoded to prevent errors in some server setups.
    $url = base64_decode($url);
    //This parameter lets users allow out-of-stock items to be displayed.
    $hidden = isset($_GET['hidden']) ? false : true;
    //Call the API using the URL.
    $details = $flipkart->call_url($url);
    if (!$details) {
        echo 'Error: Could not retrieve products list.';
        exit;
    }
コード例 #3
0
<?php 
require_once 'class.ebay.php';
include "clusterdev.flipkart-api.php";
$ebay = new ebay('VVIT41dee-646e-4494-a3f5-ba6189ac397', 'EBAY-IN');
$flipkart = new \clusterdev\Flipkart("chowdaryi", "b75ed56252de4649b6a9062107bce4fc", "json");
$sort_orders = $ebay->sortOrders();
error_reporting(0);
if (!empty($_POST['search'])) {
    $results = $ebay->findItemsAdvanced($_POST['search'], $_POST['sort']);
    $item_count = $results['findItemsAdvancedResponse'][0]['searchResult'][0]['@count'];
    $search = $_POST['search'];
    $search = str_replace(" ", "+", $search);
    $url = 'https://affiliate-api.flipkart.net/affiliate/search/json?query=' . ($url .= $search . '&resultCount=10');
    $details = $flipkart->call_url($url);
    //if(!$details)
    //{
    //echo 'Error: Could not retrieve products list.';
    //exit();
    //}
    $details = json_decode($details, TRUE);
    $products = $details['productInfoList'];
    $count = 0;
    $end = 1;
    if ($item_count > 0 || count($products) > 0) {
        $items = $results['findItemsAdvancedResponse'][0]['searchResult'][0]['item'];
        foreach ($items as $i) {
            foreach ($products as $product) {
                $inStock = $product['productBaseInfo']['productAttributes']['inStock'];
                $count++;
                $title1 = $product['productBaseInfo']['productAttributes']['title'];
コード例 #4
0
ファイル: demo1.php プロジェクト: tejeswar123/flipkart

<?php 
include "clusterdev.flipkart-api.php";
$flipkart = new \clusterdev\Flipkart("tejeswarc", "0a53dd69ce684803adb9d6a5ad822985", "json");
$search = $_POST['search'];
$s = str_replace(" ", "+", $search);
$product_url = 'https://affiliate-api.flipkart.net/affiliate/search/json?query=' . $s . '&resultCount=8';
//Call the API using the URL.
$details = $flipkart->call_url($product_url);
if (!$details) {
    echo 'Error: Could not retrieve Top Offers.';
    exit;
}
//The response is expected to be JSON. Decode it into associative arrays.
$details = json_decode($details, TRUE);
$list = $details['productInfoList'];
echo "<center><table border=1><br><br><br><br><br><br><br><br><br>";
if (count($list) > 0) {
    $i = 0;
    foreach ($list as $item) {
        //$productBaseInfo=$item['productBaseInfo'];
        //$productIdentifier=$item['productIdentifier'];
        $productId = $item['productBaseInfo']['productIdentifier']['productId'];
        $categoryPaths = $item['productBaseInfo']['productIdentifier']['categoryPaths'];
        $categoryPath = $item['productBaseInfo']['productIdentifier']['categoryPaths']['categoryPath'];
        //The API returns these values
        //	$title = $item['productBaseInfo']['productIdentifier']['categoryPaths']['categoryPath']['item']['title'];
        $productAttributes = $item['productBaseInfo']['productAttributes'];
        $title = $item['productBaseInfo']['productAttributes']['title'];
        $maximumRetailPrice = $item['productBaseInfo']['productAttributes']['sellingPrice'];
コード例 #5
0
ファイル: testsrch.php プロジェクト: apiedy/Alpha-Deals
function flipdisp()
{
    $val = "";
    include "clusterdev.flipkart-api.php";
    $flipkart = new \clusterdev\Flipkart("thealphad", "73ae7f0c01204fe6b3cec82988e05bd3", "json");
    $cat = $_POST['scat'];
    $v = $_POST['sbox'];
    $uv = urlencode($v);
    $search_url = 'https://affiliate-api.flipkart.net/affiliate/search/json?query=' . $uv . '&resultCount=8';
    $searchres = $flipkart->call_url($search_url);
    $searchres = json_decode($searchres);
    for ($i = 0; $i < 8; $i++) {
        if ($i == 0 || $i % 4 == 0) {
            echo '<div class="row">';
        }
        $title = $searchres->productInfoList[$i]->productBaseInfo->productAttributes->title;
        $sellingPrice = $searchres->productInfoList[$i]->productBaseInfo->productAttributes->sellingPrice->amount;
        $imgUrl = $searchres->productInfoList[$i]->productBaseInfo->productAttributes->imageUrls->{'200x200'};
        $prodUrl = $searchres->productInfoList[$i]->productBaseInfo->productAttributes->productUrl;
        $avlblty = $searchres->productInfoList[$i]->productBaseInfo->productAttributes->inStock;
        $description = $searchres->productInfoList[$i]->productBaseInfo->productAttributes->productDescription;
        $val .= "flip_" . $title . "_" . $sellingPrice . "_" . $imgUrl . "_" . $prodUrl . "_" . $avlblty . "_" . $description;
        $x = '<div class="gallery col-sm-3"><a href="' . $prodUrl . '" class="thumbnail">';
        $x .= "<img src='" . $imgUrl . "'>";
        $x .= "<p><b>{$title}</b></p><hr/>";
        $x .= "<p><b>{$sellingPrice}</b></p>";
        if ($avlblty == "true") {
            $x .= "<p style='color:green;'><b>Available</b></p>";
        } else {
            $x .= "<p style='color:red;'><b>Out of Stock</b></p>";
        }
        $x .= "<p style='color:blue;margin-right:6px;'>Add To Compare:<input style='margin-left:4px;margin-top:6px;' type='checkbox' name='comp[]' value='{$val}'></p>";
        $x .= "<img src='Images/ALPHA/buyfk.png' style='width:100px;height:100px;'></a></div>";
        echo $x;
        if ($i % 4 == 3) {
            echo "</div>";
        }
    }
}