Dear visitor who can read English
This page is a page translated automatically by Google AJAX Language API.
Please comment to this page if you could not understand. A PERSON will review this page .
I think that you will be able to understand this page later. Please give a little time to us.
Best regards,
This site is support & information site of WEB,and Software. This site might help you that create software or Web Site…perhaps?[:]
This time, the KAKAKU.com using the Web API, I would like to see a simple search results.
KAKAKU.com Web API in an earlier article was to "PHP at Yahoo! Web API using the"
The Web API is very similar to the idea.
Prices. Com is not an affiliate from, and there are no parameters around that, rest is almost the same idea.
Similarly, the output by parsing the XML information, retrieve the information you want to see yourself, HTML conversion information can be output.
This API is not easy and they can always make my own page to display the lowest.
Does, immediately, PHP let's try to create the sample code.
The left "application available" click, enter the following details of the screen form.
When you're done, "to register and agree to the terms of the above" button.
Screen appears informing you Yoshinobu email has been sent to the following provisional registration.
Temporary registration in the mail describing s is the URL to access to complete this registration, Web API ID (API access key) can be obtained.
Following "API access key has been issued," let's copy the part below.
Enter the URL directly, try to search.
KAKAKU.com Web API is, URL parameters to manipulate, and access to information in XML makes reply.
So, WEB browser, you can see if the direct URL address.
Does using this page, URL to create the code, let's try.
//-------------------------------------------------------------------// Define your id.//-------------------------------------------------------------------// user id informationdefine("ACCESS_KEY_ID",'Your KAKAKKU.com Web API id. ');// access url(Jpanan)define("ACCESS_URL",'http://api.kakaku.com/WebAPI/ItemSearch/Ver1.0/ItemSearch.aspx');//-------------------------------------------------------------------//http://api.kakaku.com/WebAPI/ItemSearch/Ver1.0/ProviderSearch.aspx -- プロバイダ検索API//-------------------------------------------------------------------// this function is encode with RFC3986 format.//-------------------------------------------------------------------function urlencode_RFC3986($str){returnstr_replace('%7E','~',rawurlencode($str));}//-------------------------------------------------------------------// Main routine.//-------------------------------------------------------------------$base_param='ApiKey='.ACCESS_KEY_ID;$params=array();$params['SortOrder']='pricerank';// price/name/score/sold/affiliate/review_count (+/-)$params['CategoryGroup']='Pc';// category (pc/software)$params['Keyword']='Windows 7 Microsoft';// search key ( UTF-8 )$params['HitNum']=10;// result max count.$params['PageNum']=1;// start page no$params['Charset']='utf8';// charactor code$params['ResultSet']='medium';// result info// sort $param by asc.ksort($params);// create canonical string.$canonical_string=$base_param;foreach($paramsas$k=>$v){$canonical_string.='&'.urlencode_RFC3986($k).'='.urlencode_RFC3986($v);}// create URL strings.$url= ACCESS_URL.'?'.$canonical_string;// service = itemSearch // request to amazon !!$response=file_get_contents($url);// response to strings.$parsed_xml=null;if(isset($response)){$parsed_xml=simplexml_load_string($response);}$err_count=0;// print out of response.if($response&&isset($parsed_xml)&&!isset($parsed_xml->Error)){// total results num.$total_results=$parsed_xml->NumOfResult;// total results pages.$total_pages=floor(($parsed_xml->NumOfResult+9)/10);print("All Result Count:".$total_results." | Pages :".$total_pages);print("<table>");foreach($parsed_xml->Itemas$current){$nerr=0;print('<tr><td><font size="-1">');print('<a href="'.$current->ItemPageUrl.'"><img src="'.$current-- alt=""/>ImageUrl.'" border="0"></a>');print('<a href="'.$current->ItemPageUrl.'">'.$current->ProductName.'</a>');print('Maker : '.$current->MakerName.'');print('<font color="red">Sale : '.$current->LowestPrice.'</font>');if(isset($current->PvRanking)&&!empty($current->PvRanking)){print('Ranking : '.$current->PvRanking.'');}if(isset($current->TotalScoreAve)&&!empty($current->TotalScoreAve)){print('Rate : '.$current->TotalScoreAve.'');}if(isset($current->Comment)&&!empty($current->Comment)){print('Spec : '.$current->Comment.'');}print("</td>
</tr>
");}print("</table>
");print('<a href="http://apiblog.kakaku.com/">WEB Services by 価格.com</a>');}
If used as is, if you set the following three items, "computers, peripherals" in the category, "Windows 7 Microsoft" in order to get word from the search results.
Line 6: Your Web API ID (API access key) Sets.
Set in your php file I uploaded to the WEB can be accessed on the server.
WEB browser, please upload it to access php.
For example, WEB server from the current, kakaku If you upload to the directory under the following URL to access.
http://www.example.com/kakaku/sample.php
You should see the following screen appears.
Php code where the parameters, let me explain briefly.
Where necessary changes, I think the following lines.
$ params [ 'SortOrder']
= 'Pricerank'; / / price / name / score / sold / affiliate / review_count (+/-) $ params [ 'CategoryGroup']
= 'Pc'; / / category (pc / software) $ params [ 'Keyword']
= 'Windows 7 Microsoft'; / / search key (UTF-8) $ params [ 'HitNum']
= 10; / / result max count. $ Params [ 'PageNum']
= 1; / / start page no $ params [ 'Charset']
= 'Utf8'; / / charactor code $ params [ 'ResultSet']
= 'Medium'; / / result info 31 line: 'SortOrder' specifies the order of search results.
Here, 'sold' = specifies the order from.
pricerank:
Low → high -pricerank:
High → low daterank:
By Release Date (new → old) popularityrank:
Most Watched * If specified Shi無I is the order of popularity.
Specify multiple ordering is not.
Line 32: 'CategoryGroup' specifies the name of the category to be searched.
Here, "Pc" of "computers, peripherals," has been specified.
The category name specified here is as follows.
Pc & Computer Kaden Appliances Camera Camera Game Game Gakki instruments Kuruma EoCN Sports and Leisure Sports Brand watches Brand Baby & Kids Baby Pet Pet Health and Beauty Beauty_Health All of the above ALL
Line 41: 'Keyword' is the string to search.
Here, "Windows 7 Microsoft" has conducted a search of the AND.
Line 42: 'HitNum' specifies how many pieces to maximize the output results.
Here, we specify that up to 10 search results for each.
Line 43: 'PageNum' specifies whether to print many pages of search results.
Here, one has to specify that the first search results page.
Line 44: 'Charset' specifies the character encoding of the search results.
Here, "utf8" = UTF-8 is specified.
sjis:
SHIFT-JIS utf8:
UTF-8 euc:
EUC-JP Line 43: 'ResultSet', the type of information in search results (volume) is specified.
Here, "medium" = specifies the default.
mini / medium specifies either.
Line 57: The output information is converted to the XML parser information between strings.
Also Line 98: Here is the KAKAKU.com's "credit view" is.
On the terms, such as "credit view" should not and must not put the.
For more information, Http://Apiblog.kakaku.com/Credit.html Please refer to.
It was a brief description, price like this. Com you can do a search.
If you have little knowledge of PHP, for my money. Com and you can create a ranking table.
This is a human-readable, XML output I tried to create a solid.
Also, his look and touch and everything, I think better understanding.
Once it is tested invite you.
(Introduction of the book appears below, this KAKAKU.com Web API results are displayed with the search.
)
Leave a Reply