ܻؤ1顪30奵꡼ޥܥ

ITȤƯ30奵꡼ޥΥ饤ߥ󥰵Ͽ

ƥꡧ web

5ގَ
äAmazon᡼ƤΤбƤߤޤ
꤮ˤʤʤȤʤ
Ƶ٤ߤνȤäǤ

Ȥ櫓ǺޤϤƤparamȥåȥϤ
URL֤Ƥؿ

˼ʬѡ
֤ͤϤѤȤ͡

function amazonSignature ($param=array(), $secretKey="") {
  $aws = array("host" => "webservices.amazon.co.jp", "path" => "/onca/xml");
  ksort($param);

  $reqParam = array();
  foreach ($param as $key => $val) {
    $reqParam[] = $key . "=" . rawurlencode($val);
  }

  $paramStr = implode("&", $reqParam);
  $str = implode("\n", array('GET', $aws["host"], $aws["path"], $paramStr));
  $sig = rawurlencode( base64_encode( hash_hmac("sha256", $str, $secretKey, true)));
  $reqParam[] = "Signature=" . $sig;
  $url = "http://" . $aws["host"]. $aws["path"] . "?" . implode("&", $reqParam);

  return $url;
}

ʤߤparamˤϤʴΥǡ
ˤ碌ѹ
$param = array(
               "Service" => "AWSECommerceService",
               "AWSAccessKeyId" => "YOUR ACCESS KEY",
               "Operation" => "ItemSearch",
               "SearchIndex" => "Books",
               "ResponseGroup" => "Medium,Tracks",
               "BrowseNode" => "465610",
               "Timestamp" => gmdate("Y-m-d\TH:i:s\Z"),
               );
    Υȥ꡼ϤƤʥ֥åޡɲ

ȤǥԥڤǻȤ褦˥⡣

ܸʸϤȥե졼ФƤ롣
ʡοǿ礭ۤɽ٤⤤
appid
쥹ݥ󥹷jsonxmlphp serializeǽ
*)jQueryѡ


ɤϰʲ
$(function(){
  $("#postSentence").submit(function() {
    $("#postResult").empty();
    search($("#sentence").val());
    return false;
  });
  function search(text) {
    $("#postResult").text("Now Loading....");
    $.ajax({
      dataType: "jsonp",
      data: {
        "appid":"your appid",
        "sentence":text,
        "output":"json",
        "max-result":10,
      },
      cache: true,
      url: "http://jlp.yahooapis.jp/KeyphraseService/V1/extract",
      success: function(data) {
        var ul = $(document.createElement("ul"));
        ul.addClass("class20090807");
        $.each(data, function(word, score) {
          ul.append($(document.createElement("li"))
          .append(word)
          .append(' ('+score+')'));
        });
        $("#postResult").html(ul);
      }
    });
  }
});
    Υȥ꡼ϤƤʥ֥åޡɲ

ΥڡΥȥåץ