How do I get a book graphic and description from the Amazon Book API?

后端 未结 3 660
我在风中等你
我在风中等你 2020-12-23 14:43

This URL sends an ISBN number to Amazon and gets back a small bit of XML including author, title, and publisher.

However, I also want to get small, medium and large

3条回答
  •  天命终不由人
    2020-12-23 15:30

    I have build some functions to grab amazon xml using php and curl using simple functions just like this:

        $value)
    {
    $slugs = str_replace("%7E", "~", rawurlencode($slugs));
    $value = str_replace("%7E", "~", rawurlencode($value));
    $query_slug[] = $slugs."=".$value;
    }
    $query_slug = implode("&", $query_slug);
    $signinurl = $method."\n".$host."\n".$uri."\n".$query_slug;
    $signature = base64_encode(hash_hmac("sha256", $signinurl, $secretkey, True)); // Get Amazon Signature API
    $signature = str_replace("%7E", "~", rawurlencode($signature));
    $request = "http://".$host.$uri."?".$query_slug."&Signature=".$signature;
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; Konqueror/4.0; Microsoft Windows) KHTML/4.0.80 (like Gecko)");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_URL, $request);
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    $response = curl_exec($ch);
    curl_close($ch);
    return $response;
    }
    ?>
    

提交回复
热议问题