ยินดีต้อนรับคุณ, บุคคลทั่วไป กรุณา เข้าสู่ระบบ หรือ ลงทะเบียน

เข้าสู่ระบบด้วยชื่อผู้ใช้ รหัสผ่าน และระยะเวลาในเซสชั่น

ThaiSEOBoard.comความรู้ทั่วไปAmazonขอ Code Compare ของ amazon หน่อยครับ
หน้า: [1]   ลงล่าง
พิมพ์
ผู้เขียน หัวข้อ: ขอ Code Compare ของ amazon หน่อยครับ  (อ่าน 7218 ครั้ง)
0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้
kkusd
Verified Seller
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 311
ออฟไลน์ ออฟไลน์

กระทู้: 4,663



ดูรายละเอียด
« เมื่อ: 31 สิงหาคม 2010, 21:02:29 »

ขอหน่อยครับเอาแบบเป็น php เอาไปใช้ได้กับหน้า html ธรรมดากจะดีมากเลยครับ wanwan017 wanwan017



ทำเสร็จแล้วจะเอามาแจก
บันทึกการเข้า

kkusd
Verified Seller
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 311
ออฟไลน์ ออฟไลน์

กระทู้: 4,663



ดูรายละเอียด
« ตอบ #1 เมื่อ: 31 สิงหาคม 2010, 21:12:16 »

ไม่เลยเหรอ สงสัยเก็บไว้ใช้คนเดียว
บันทึกการเข้า

medieval
สมุนแก๊งเสียว
*

พลังน้ำใจ: 70
ออฟไลน์ ออฟไลน์

กระทู้: 875



ดูรายละเอียด
« ตอบ #2 เมื่อ: 31 สิงหาคม 2010, 21:15:12 »

ลองไปศึกษา ใน155cafe ในไฟล์ newfunc.php ดูครับ  ค้นหาคำว่า## Merchant  อยู่แถวนั่นละครับ ถ้าให้อธิบายคงยาวเป็นกอง คงช่วยได้แค่นี้ละครับ  wanwan017

http://www.thaiseoboard.com/index.php/topic,120721.0.html
« แก้ไขครั้งสุดท้าย: 31 สิงหาคม 2010, 21:15:33 โดย medieval » บันทึกการเข้า

IzeSem
หัวหน้าแก๊งเสียว
*

พลังน้ำใจ: 61
ออฟไลน์ ออฟไลน์

กระทู้: 1,386



ดูรายละเอียด
« ตอบ #3 เมื่อ: 31 สิงหาคม 2010, 21:19:08 »

เดี๊ยวผมทำให้ง่ายๆแปร๊บนะ
บันทึกการเข้า
sugar
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 113
ออฟไลน์ ออฟไลน์

กระทู้: 4,647



ดูรายละเอียด เว็บไซต์
« ตอบ #4 เมื่อ: 31 สิงหาคม 2010, 21:21:49 »

 wanwan004 มารอแต็งให้ด้วยอีกคน  wanwan013
บันทึกการเข้า

kkusd
Verified Seller
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 311
ออฟไลน์ ออฟไลน์

กระทู้: 4,663



ดูรายละเอียด
« ตอบ #5 เมื่อ: 31 สิงหาคม 2010, 21:36:17 »

ลองไปศึกษา ใน155cafe ในไฟล์ newfunc.php ดูครับ  ค้นหาคำว่า## Merchant  อยู่แถวนั่นละครับ ถ้าให้อธิบายคงยาวเป็นกอง คงช่วยได้แค่นี้ละครับ  wanwan017

http://www.thaiseoboard.com/index.php/topic,120721.0.html


ขอบคุณครับ เก็บไว้แกะโค้ต

เดี๊ยวผมทำให้ง่ายๆแปร๊บนะ


ขอบคุณล่วงหน้าครับ wanwan020 wanwan020
บันทึกการเข้า

IzeSem
หัวหน้าแก๊งเสียว
*

พลังน้ำใจ: 61
ออฟไลน์ ออฟไลน์

กระทู้: 1,386



ดูรายละเอียด
« ตอบ #6 เมื่อ: 31 สิงหาคม 2010, 21:41:04 »

ไฟล์ test.php
โค๊ด:
<?php 
require_once(
"aws_signed_request.php");
$public_key  =""
$private_key =""
$tag ="";
$parsed_xml aws_signed_request("com", array("Operation"=>"ItemLookup","ItemId"=>"B002LITT56","ResponseGroup"=>"Large, OfferFull","MerchantId"=>"Featured","AssociateTag"=>"$tag"),$public_key$private_key);
$buyurl $parsed_xml->Items->Item->ItemLinks->ItemLink[6]->URL;
?>

<div align="center">
<table width="880" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="250" align="center" bgcolor="#eeeeee"><strong>Seller</strong></td>
            <td width="360" align="center" bgcolor="#eeeeee"><strong>Description</strong></td>
            <td width="250" align="center" bgcolor="#eeeeee"><strong>Price</strong></td>
          </tr>
          <?php 
foreach ($parsed_xml->Items->Item->Offers->Offer as $offer) {
$merchantname $offer->Merchant->Name;
$availability $offer->OfferListing->Availability;
$supersaving $offer->OfferListing->IsEligibleForSuperSaverShipping;
if  (
$supersaving==1){
                 
$supersaving "<br />This item ships for <strong>FREE with Super Saver Shipping</strong>.<br />";
}else{
                 
$supersaving ="<br />";
}
$price $offer->OfferListing->Price->FormattedPrice;
?>

   <tr>
            <td width="250" align="center" valign="middle"><?php echo "<strong>".$merchantname."</strong>"?><br /></td>
            <td width="360" align="left" valign="middle"><?php echo $availability.$supersaving?></td>
            <td width="250" align="center" valign="middle"><table width="250" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td align="center"><?php echo $price;?></td>
              </tr>
              <tr>
                <td align="center">
                <a href="<?php echo $buyurl;?>" target="_blank">Go to Store</a>
                </td>
              </tr>
            </table>
  </td>
          </tr>
          <tr>
            <td colspan="3" valign="top"></td>
          </tr>
          <?php }?>
          <tr>
                </tr>
                </table>
                </div>
ไฟล์ aws_signed_request.php กำหนด api เป็น API Version 2010-06-01
โค๊ด:
<?php

function aws_signed_request($region$params$public_key$private_key)
{
    
/*
    Copyright (c) 2009 Ulrich Mierendorff

    Permission is hereby granted, free of charge, to any person obtaining a
    copy of this software and associated documentation files (the "Software"),
    to deal in the Software without restriction, including without limitation
    the rights to use, copy, modify, merge, publish, distribute, sublicense,
    and/or sell copies of the Software, and to permit persons to whom the
    Software is furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    DEALINGS IN THE SOFTWARE.
    */
    
    /*
    Parameters:
        $region - the Amazon(r) region (ca,com,co.uk,de,fr,jp)
        $params - an array of parameters, eg. array("Operation"=>"ItemLookup",
                        "ItemId"=>"B000X9FLKM", "ResponseGroup"=>"Small")
        $public_key - your "Access Key ID"
        $private_key - your "Secret Access Key"
    */

    // some paramters
    
$method "GET";
    
$host "ecs.amazonaws.".$region;
    
$uri "/onca/xml";
    
    
// additional parameters
    
$params["Service"] = "AWSECommerceService";
    
$params["AWSAccessKeyId"] = $public_key;
    
// GMT timestamp
    
$params["Timestamp"] = gmdate("Y-m-d\TH:i:s\Z");
    
// API version
    
$params["Version"] = "2010-06-01";
    
    
// sort the parameters
    
ksort($params);
    
    
// create the canonicalized query
    
$canonicalized_query = array();
    foreach (
$params as $param=>$value)
    {
        
$param str_replace("%7E""~"rawurlencode($param));
        
$value str_replace("%7E""~"rawurlencode($value));
        
$canonicalized_query[] = $param."=".$value;
    }
    
$canonicalized_query implode("&"$canonicalized_query);
    
    
// create the string to sign
    
$string_to_sign $method."\n".$host."\n".$uri."\n".$canonicalized_query;
    
    
// calculate HMAC with SHA256 and base64-encoding
    
$signature base64_encode(hash_hmac("sha256"$string_to_sign$private_keyTrue));
    
    
// encode the signature for the request
    
$signature str_replace("%7E""~"rawurlencode($signature));
    
    
// create request
    
$request "http://".$host.$uri."?".$canonicalized_query."&Signature=".$signature;
    
    
// do request
$strload curl_init($request);
           curl_setopt($strloadCURLOPT_HEADERfalse);
           curl_setopt($strloadCURLOPT_RETURNTRANSFERtrue);
$responsecurl_exec($strload);
           curl_close($strload);
    if (
$response === False)
    {
        return 
False;
    }
    else
    {
        
// parse XML
        
$pxml simplexml_load_string($response);
        if (
$pxml === False)
        {
            return 
False// no xml
        
}
        else
        {
            return 
$pxml;
        }
    }
}
?>

แก้
   $public_key  ="";
   $private_key ="";
   $tag ="";
บันทึกการเข้า
olomixolo
ก๊วนเสียว
*

พลังน้ำใจ: 4
ออฟไลน์ ออฟไลน์

กระทู้: 224



ดูรายละเอียด เว็บไซต์
« ตอบ #7 เมื่อ: 31 สิงหาคม 2010, 21:43:14 »

ขอบคุณ ครับ แต่ยัง งงๆ อยู่ นะ
 Tongue
บันทึกการเข้า

sugar
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 113
ออฟไลน์ ออฟไลน์

กระทู้: 4,647



ดูรายละเอียด เว็บไซต์
« ตอบ #8 เมื่อ: 31 สิงหาคม 2010, 21:47:14 »

ไฟล์ test.php
โค๊ด:
<?php 
require_once(
"aws_signed_request.php");
$public_key  =""
$private_key =""
$tag ="";
$parsed_xml aws_signed_request("com", array("Operation"=>"ItemLookup","ItemId"=>"B002LITT56","ResponseGroup"=>"Large, OfferFull","MerchantId"=>"Featured","AssociateTag"=>"$tag"),$public_key$private_key);
$buyurl $parsed_xml->Items->Item->ItemLinks->ItemLink[6]->URL;
?>

<div align="center">
<table width="880" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="250" align="center" bgcolor="#eeeeee"><strong>Seller</strong></td>
            <td width="360" align="center" bgcolor="#eeeeee"><strong>Description</strong></td>
            <td width="250" align="center" bgcolor="#eeeeee"><strong>Price</strong></td>
          </tr>
          <?php 
foreach ($parsed_xml->Items->Item->Offers->Offer as $offer) {
$merchantname $offer->Merchant->Name;
$availability $offer->OfferListing->Availability;
$supersaving $offer->OfferListing->IsEligibleForSuperSaverShipping;
if  (
$supersaving==1){
                 
$supersaving "<br />This item ships for <strong>FREE with Super Saver Shipping</strong>.<br />";
}else{
                 
$supersaving ="<br />";
}
$price $offer->OfferListing->Price->FormattedPrice;
?>

   <tr>
            <td width="250" align="center" valign="middle"><?php echo "<strong>".$merchantname."</strong>"?><br /></td>
            <td width="360" align="left" valign="middle"><?php echo $availability.$supersaving?></td>
            <td width="250" align="center" valign="middle"><table width="250" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td align="center"><?php echo $price;?></td>
              </tr>
              <tr>
                <td align="center">
                <a href="<?php echo $buyurl;?>" target="_blank">Go to Store</a>
                </td>
              </tr>
            </table>
  </td>
          </tr>
          <tr>
            <td colspan="3" valign="top"></td>
          </tr>
          <?php }?>
          <tr>
                </tr>
                </table>
                </div>
ไฟล์ aws_signed_request.php กำหนด api เป็น API Version 2010-06-01
โค๊ด:
<?php

function aws_signed_request($region$params$public_key$private_key)
{
    
/*
    Copyright (c) 2009 Ulrich Mierendorff

    Permission is hereby granted, free of charge, to any person obtaining a
    copy of this software and associated documentation files (the "Software"),
    to deal in the Software without restriction, including without limitation
    the rights to use, copy, modify, merge, publish, distribute, sublicense,
    and/or sell copies of the Software, and to permit persons to whom the
    Software is furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    DEALINGS IN THE SOFTWARE.
    */
    
    /*
    Parameters:
        $region - the Amazon(r) region (ca,com,co.uk,de,fr,jp)
        $params - an array of parameters, eg. array("Operation"=>"ItemLookup",
                        "ItemId"=>"B000X9FLKM", "ResponseGroup"=>"Small")
        $public_key - your "Access Key ID"
        $private_key - your "Secret Access Key"
    */

    // some paramters
    
$method "GET";
    
$host "ecs.amazonaws.".$region;
    
$uri "/onca/xml";
    
    
// additional parameters
    
$params["Service"] = "AWSECommerceService";
    
$params["AWSAccessKeyId"] = $public_key;
    
// GMT timestamp
    
$params["Timestamp"] = gmdate("Y-m-d\TH:i:s\Z");
    
// API version
    
$params["Version"] = "2010-06-01";
    
    
// sort the parameters
    
ksort($params);
    
    
// create the canonicalized query
    
$canonicalized_query = array();
    foreach (
$params as $param=>$value)
    {
        
$param str_replace("%7E""~"rawurlencode($param));
        
$value str_replace("%7E""~"rawurlencode($value));
        
$canonicalized_query[] = $param."=".$value;
    }
    
$canonicalized_query implode("&"$canonicalized_query);
    
    
// create the string to sign
    
$string_to_sign $method."\n".$host."\n".$uri."\n".$canonicalized_query;
    
    
// calculate HMAC with SHA256 and base64-encoding
    
$signature base64_encode(hash_hmac("sha256"$string_to_sign$private_keyTrue));
    
    
// encode the signature for the request
    
$signature str_replace("%7E""~"rawurlencode($signature));
    
    
// create request
    
$request "http://".$host.$uri."?".$canonicalized_query."&Signature=".$signature;
    
    
// do request
$strload curl_init($request);
           curl_setopt($strloadCURLOPT_HEADERfalse);
           curl_setopt($strloadCURLOPT_RETURNTRANSFERtrue);
$responsecurl_exec($strload);
           curl_close($strload);
    if (
$response === False)
    {
        return 
False;
    }
    else
    {
        
// parse XML
        
$pxml simplexml_load_string($response);
        if (
$pxml === False)
        {
            return 
False// no xml
        
}
        else
        {
            return 
$pxml;
        }
    }
}
?>

แก้
   $public_key  ="";
   $private_key ="";
   $tag ="";



กดแทงให้แล้ว ค่า เดี๋ยวลองไปมั่วต่อดู  Embarrassed ก็ งงนิสๆๆ  Tongue
บันทึกการเข้า

หน้า: [1]   ขึ้นบน
พิมพ์