Amazon APIをWebサイトに統合しようとしていますが、これまでのところ、正しいxml部分に移動して変数として保存することができましたが、この変数をmysqlデータベースに挿入しようとしていますが、これが得られますエラー
注意: 未定義の変数: 致命的なエラーの sql_select: 非オブジェクトでのメンバー関数 query() の呼び出し
私は何を間違っていますか?
コード全体
define('INCLUDED', 1);
error_reporting(E_ALL);
ini_set("display_errors", 1);
$AWS_ACCESS_KEY_ID = "HIDDENFORPRIVACY";
$AWS_SECRET_ACCESS_KEY = "HIDDENFORPRIVACY";
$base_url = "http://free.apisigning.com/onca/xml?";
$url_params = array('Operation'=>"ItemLookup",'Service'=>"AWSECommerceService",
'AWSAccessKeyId'=>$AWS_ACCESS_KEY_ID,'AssociateTag'=>"HIDDENFORPRIVACY",
'Version'=>"2011-08-01",'Availability'=>"Available",'ItemId'=>"0273702440",
'ItemPage'=>"1",'ResponseGroup'=>"EditorialReview", 'Title'=>"Accounting and Finance for Non-Specialists 5th Edition");
// Add the Timestamp
$url_params['Timestamp'] = gmdate("Y-m-d\TH:i:s.\\0\\0\\0\\Z", time());
// Sort the URL parameters
$url_parts = array();
foreach(array_keys($url_params) as $key)
$url_parts[] = $key."=".$url_params[$key];
sort($url_parts);
// Construct the string to sign
//$string_to_sign = "GET\nhttp://free.apisigning.com/".implode("&",$url_parts);
//$string_to_sign = str_replace('+','%20',$string_to_sign);
//$string_to_sign = str_replace(':','%3A',$string_to_sign);
//$string_to_sign = str_replace(';',urlencode(';'),$string_to_sign);
// Sign the request
//$signature = hash_hmac("sha256",$string_to_sign,$AWS_SECRET_ACCESS_KEY,TRUE);
// Base64 encode the signature and make it URL safe
//$signature = base64_encode($signature);
//$signature = str_replace('+','%2B',$signature);
//$signature = str_replace('=','%3D',$signature);
//$signature = str_replace(';',urlencode(';'),$string_to_sign);
$url_string = implode("&",$url_parts);
$url = $base_url.$url_string;
//print $url;
$ch = curl_init(); //this part we set up curl
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$xml_response = curl_exec($ch);
curl_close($ch);
header('Content-type: application/xml'); //specify as xml to not display as one long string
echo $xml_response;
$xml = new SimpleXMLElement($xml_response); //time to echo back the correct piece of data
$editorialReview = $xml->Items->Item->EditorialReviews->EditorialReview->Content;
$variable = '<p>Editorial review: '.html_entity_decode($editorialReview).'</p>'."\n";
echo $variable;
$sql_select = mysql_query("INSERT INTO " . DB_PREFIX . "auctions
(amazon_description) VALUES
('" . $variable . "')");
echo ($sql_select);
これはエラーを送信しませんが、mysql データベースは変化を示しません