There is also this article ...
-
How to use Open Source PDFCrack
Summary: This is an open source PDF is PDFCrack Pasuwadokurakka I would like to try. This soft, pretty, well known colors are introduced at various sites. Here, this is PDFCrac ...
Recently Updated Articles
Summary:
This time, Yahoo! Using the Web API, I would like to see a simple search results.
Yahoo! Web API in an earlier article was the "Amazon Product Advertising API using PHP in the" Is similar to the idea of the Product Advertising API.
Amazon is the latest version, the authentication steps are added, Yahoo! Is still authentication feature is not available.
Amazon Similarly, the output, XML output format. (PHP If you specify a dare, Serialize is hidden in. )
By analyzing the output of XML information, retrieve the information you want to see yourself, HTML conversion information can be output.
For example, Amazon affiliate widgets such as those being offered in for your Yahoo! Shop is not a version that can also be created.
In addition, Yahoo! To, Amazon unlike here to introduce Yahoo! As well as Shopping, Yahoo! Regular search service and Yahoo! As well as auctions, you can use this Web API Using.
Does, immediately, PHP let's try to create the sample code.
See page: Http://Developer.yahoo.co.jp/ reference page: Http://Shopping.yahoo.co.jp/Affiliate/
First, let's prepare.
Yahoo! ID is required.
Here, Yahoo! ID as they already have, and later to write.
(If you do not have it, Yahoo! Let's get on. )
Yahoo! Web API to use, you first need to get under your ID. Also, if you also do affiliate, the affiliate ID is also required.
If you want to affiliate, affiliate ID (Yahoo! Affiliate ID or, ValueCommerce of the ID or the Isure) is required.
Yahoo! If you want shopping and other affiliates, ValueCommerce of acceptable ID will get the better off.
ValueCommerce ID is
http://www.valuecommerce.ne.jp can register for free.
ValueCommerce the ID does not have a (not registered) cases, Yahoo! Affiliate ID is required.
Yahoo! Affiliate ID is, Yahoo! ID is not.
Yahoo! Affiliate ID is obtained as follows.
Yahoo! If you want shopping and other affiliates, ValueCommerce of acceptable ID will get the better off.
ValueCommerce ID is
ValueCommerce the ID does not have a (not registered) cases, Yahoo! Affiliate ID is required.
Yahoo! Affiliate ID is, Yahoo! ID is not.
Yahoo! Affiliate ID is obtained as follows.
- http://shopping.yahoo.co.jp/affiliate/ access to.

- On the "Login" and click the Yahoo! ID to login.

After logging in, from the same screen appears, this time, the left "Yahoo! You agree to the Terms of Use Affiliate" button.

- Yahoo! Terms of Service screen appears so affiliate, if properly done, the bottom of the screen "I agree" button.

After processing is complete, return to the original screen, the left "affiliate ID Verify" button.

- Following affiliate ID will be displayed, where you'll copy the affiliate ID.

Web API ID (application ID) get to see.
- http://developer.yahoo.co.jp/ access to.

- On the "Login" and click the Yahoo! ID to login.
After logging in, from the same screen appears, this time, the right "application ID register (free)" button.
E-mail contact, OAuth Do you want to use? Whether to accept the guidelines?
Answer the item.
OAuth is here, then leave without.
When you complete the "confirm" button.
- A confirmation screen will appear, especially if there are no mistakes "Register" button.

The following screen is the screen after completing registration.
Following "Your Yahoo! JAPAN ID applications that are registered with the ID" let's copy the part.

Enter the URL directly, try to search.
Yahoo! 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.
- Yahoo! Sample of shopping to find something in the URL, Http://Developer.yahoo.co.jp/Webapi/Shopping/Shopping/V1/Itemsearch.html located.
http://shopping.yahooapis.jp/ShoppingWebService/V1/itemSearch?appid=<your application id>&query=vaio
URL of this sample <your application id>: you get ahead in, Web API ID (application ID) to specify, Web browsers let you type directly.

- Information such as the following reply (XML information) think it will be displayed.

If this screen appears OK.
Check the operating environment for PHP.
Make sure that PHP can work.
The following is, Windows is an example of the command prompt confirmation.
Enter the UNIX command can be found as well.
C:\> php -v
PHP 5.1.2 (cli) (built: Jan 11 2006 16:40:00)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
In this article, the version must be at least PHP5.
Now you are ready. Next, PHP code to the original sample, let's try.
PHP using the sample source, try this.
The following is a simple software to search for PHP is the sample source.
[sample.php]
1 23 45 67 89 1011 1213 1415 1617 1819 2021 2223 2425 2627 2829 3031 3233 3435 3637 3839 4041 4243 4445 4647 4849 5051 5253 5455 5657 5859 6061 6263 6465 6667 6869 7071 7273 7475 7677 7879 8081 8283 8485 8687 8889 9091 9293 9495 9697 9899 100101 102103 104105 106107 108109 110111 112113 114115 116117 118 | <?php //-------------------------------------------------------------------// Define your id. //-------------------------------------------------------------------// user id information define("ACCESS_KEY_ID" , 'Your Yahoo! Web API id. ');// yid = Yahoo! affiliate id , vc = ValueCommerce id define("AFFILIATE_COM" , 'yid/vc' );define("AFFILIATE_TAG" , 'Your Yahoo! or ValueCommerce affiliate id.' ); // access url(Jpanan) define("ACCESS_URL" , 'http://shopping.yahooapis.jp/ShoppingWebService/V1/');//------------------------------------------------------------------- //http://shopping.yahooapis.jp/ShoppingWebService/V1/itemSearch? -- item search//http://shopping.yahooapis.jp/ShoppingWebService/V1/categorySearch? -- category search //-------------------------------------------------------------------// this function is encode with RFC3986 format. //-------------------------------------------------------------------function urlencode_RFC3986($str) { return str_replace('%7E', '~', rawurlencode($str)); } //------------------------------------------------------------------- // Main routine.//------------------------------------------------------------------- $base_param = 'appid='.ACCESS_KEY_ID; $params = array(); $params['affiliate_type'] = AFFILIATE_COM; $params['affiliate_id'] = AFFILIATE_TAG; $params['sort'] = '-sold'; // price/name/score/sold/affiliate/review_count (+/-)$params['type'] = 'all'; // all/any //$params['category_id'] = 10002; // category (book)$params['category_id'] = 2502; // category (pc/software) $params['query'] = 'Windows 7 Microsoft'; // search key ( UTF-8 ) $params['offset'] = 0; // [1-20] // sort $param by asc.ksort($params); // create canonical string. $canonical_string = $base_param;foreach ($params as $k => $v) { $canonical_string .= '&'.urlencode_RFC3986($k).'='.urlencode_RFC3986($v);} // create URL strings. $url = ACCESS_URL.'itemSearch?'.$canonical_string; // service = itemSearch // request to yahoo !!$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->attributes()->totalResultsReturned) ){ // total results num. $total_results = $parsed_xml->attributes()->totalResultsAvailable; // total results pages. $total_pages = floor(($parsed_xml->attributes()->totalResultsAvailable + 19)/20); print("All Result Count:".$total_results." | Pages :".$total_pages ); print("<table>"); foreach($parsed_xml->Result->Hit as $current){ $nerr=0; print("<tr><td><font size='-1'>"); print('<a href="'.$current->Url.'"><img src="'.$current->Image->Small.'" border=0></a><br >'); print('<a href="'.$current->Url.'">'.$current->Name.'</a><br />'); // print('JAN CODE : '.$current->JanCode.'<br />'); print($current->Price->attributes()->currency); if($current->PriceLabel->attributes()->taxIncluded){ print( " TAX (INCLUDE) : "); } else { print( " TAX (Not INCLUDE) : "); } if(isset($current->PriceLabel->SalePrice) && $current->PriceLabel->SalePrice>0){ print('<br />'); if(isset($current->PriceLabel->FixedPrice) && $current->PriceLabel->FixedPrice>0){ print($current->PriceLabel->FixedPrice.'<br />'); } else if( (int)$current->PriceLabel->SalePrice != (int)$current->Price ){ print($current->Price.'<br />'); } print('<font color=red>Sale : '.$current->PriceLabel->SalePrice.'</font><br />'); } else { print($current->Price.'<br />'); } if(isset($current->Review) && isset($current->Review->Rate) && $current->Review->Count>0){ print('Rate:<a href="'.$current->Review->Url.'">'); print($current->Review->Rate.'('. $current->Review->Count .')'.'<br />'); print('</a><hr />'); } print("</td></tr>"); } print("</table>");} ?> |
If used as is, if you set the following three items, "computers, peripherals" in the category, "Windows 7 Microsoft" by selling the results of search on the keyword (Ascending) Gets. Line 6: Your Web API ID (application ID) to set up.
Line 8: your affiliate ID type (Yahoo! Affiliate ID (= yid) or ValueCommerce the ID (= vc) or be one) to set up.
Line 9: your affiliate ID (Yahoo! Affiliate ID or the ID of one or ValueCommerce) 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, yahoo If you upload to the directory under the following URL to access.
http://www.example.com/yahoo/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.
Line 37: 'sort' specifies the order of search results. Here, 'sold' = is specified in ascending order selling.
price: Price
name: Store Name
score: Recommended by
sold: By selling
affiliate: Premiums by affiliate
review_count: AZ of reviews
The top, + - and to add, - (descending) or + (Ascending) will be.
Line 38: 'type' is AND search multiple search characters (= all) or a, OR search (= any) to specify whether the.
Here, AND we conducted a search.
Line 40: 'category_id', the category ID to specify the search criteria.
Here, "2502" for "personal computer peripherals," has been specified.
Category ID is specified here, the following URL can be confirmed.
Id is the output XML tag information, the category ID.
Line 41: 'query' is a string to search. Here, "Windows 7 Microsoft" has conducted a search of the AND.
Line 42: 'offset' specifies whether the output from what number of search results. One single search result, get the results up to 20 pieces. 0 means the beginning.
Search criteria, you can also specify a lot. For more information, please see the following pages.
http://developer.yahoo.co.jp/webapi/shopping/shopping/v1/itemsearch.html
Line 63: The output information is converted to the XML parser information between strings.
Where necessary changes, I think the following lines.
Line 37: 'sort' specifies the order of search results. Here, 'sold' = is specified in ascending order selling.
price: Price
name: Store Name
score: Recommended by
sold: By selling
affiliate: Premiums by affiliate
review_count: AZ of reviews
The top, + - and to add, - (descending) or + (Ascending) will be.
Line 38: 'type' is AND search multiple search characters (= all) or a, OR search (= any) to specify whether the.
Here, AND we conducted a search.
Line 40: 'category_id', the category ID to specify the search criteria.
Here, "2502" for "personal computer peripherals," has been specified.
Category ID is specified here, the following URL can be confirmed.
http://shopping.yahooapis.jp/ShoppingWebService/V1/categorySearch?appid=<your application id>&category_id=1URL of this sample <your application id>: you get ahead in, Web API ID (application ID) to specify, Web browsers let you type directly.
Id is the output XML tag information, the category ID.
Line 41: 'query' is a string to search. Here, "Windows 7 Microsoft" has conducted a search of the AND.
Line 42: 'offset' specifies whether the output from what number of search results. One single search result, get the results up to 20 pieces. 0 means the beginning.
Search criteria, you can also specify a lot. For more information, please see the following pages.
http://developer.yahoo.co.jp/webapi/shopping/shopping/v1/itemsearch.html
Line 63: The output information is converted to the XML parser information between strings.
The explanation was simple, like this Yahoo! You can do a search and shopping.
If you have little knowledge of PHP, like Amazon's own widget for Yahoo! Can create a shopping version.
This is a human-readable, XML output I tried to create a solid. Yahoo! Web API does, PHP is also available for it, I can create some easy to use and there.
Also, his look and touch and everything, I think better understanding. Once it is tested invite you.
(Introduction of the book appears below, this Yahoo! Web API results are displayed with the search. )
If you have little knowledge of PHP, like Amazon's own widget for Yahoo! Can create a shopping version.
This is a human-readable, XML output I tried to create a solid. Yahoo! Web API does, PHP is also available for it, I can create some easy to use and there.
Also, his look and touch and everything, I think better understanding. Once it is tested invite you.
(Introduction of the book appears below, this Yahoo! Web API results are displayed with the search. )
今回の記事では、PHPについて、少し知識が必要です。詳しく知りたい方は、以下の本なども良いと思います。本から学ぶことは多いと思います。ネットだけでは判らない様々な事に気づかされます。
CakePHPポケットリファレンス [本] | PHPによるWebアプリケーションスーパーサンプル 第2版 [本] | Webアプリケーション開発教本 PHP and MySQL編 [本] | 【予約】新標準SQLite オープンソースRDBMSシリーズ [本] | PHPの絵本 Webアプリ作りが楽しくなる9つの扉 [本] |
Last Updated on Wednesday, 14 October 2009 18:22







