iTunes Store的API - 按热门程度排序 [英] iTunes Store API -- sorting by popularity

查看:260
本文介绍了iTunes Store的API - 按热门程度排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以搜索<一个href=\"http://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html\"相对=nofollow> iTunes Store的API ,然后按热门程度排序的结果?

Is it possible to search the iTunes Store API and sort results by popularity?

如果没有,什么是下一个最好的选择吗?屏幕刮的iTunes preVIEW 页面?

If not, what is the next best alternative? Screen-scraping the iTunes Preview pages?

推荐答案

下面是你的问题的步骤
你需要进行两个文件。

Here is the steps for your problem you need to make two file.

1),对于喜欢tune.php

1) Wrapper file for itune API like "tune.php"

2)文件格式retrive结果get_result_from_api.php

2) file form retrive the results "get_result_from_api.php"

的**第1步:获取API URL *的 *

请确保您的iTune的API正常工作

make sure that your itune api work properly

作为例如

在此输入code

$ authentic_api = $这个 - > endpointurl。 '?API_KEY ='。 $这个 - > API_KEY。 '和;方法='。 aj.jobs.search。 '和;关键词='。 $这个 - >关键字。 '和;位置='。 $这个 - >位置。 '和; perpage ='。 $这个 - > perpage;

$authentic_api = $this->endpointurl . '?api_key=' . $this->api_key . '&method=' . 'aj.jobs.search' . '&keywords=' . $this->keywords . '&location=' . $this->location. '&perpage=' . $this->perpage ;

回声$ authentic_api;

echo $authentic_api;

OUTPUT:

<一个href=\"http://www.authenticjobs.com/api/?api_key=3fb9a030d223ac8bb06eb07fea846182&method=aj.jobs.search&keywords=&location=&perpage=100\" rel=\"nofollow\">http://www.authenticjobs.com/api/?api_key=3fb9a030d223ac8bb06eb07fea846182&method=aj.jobs.search&keywords=&location=&perpage=100

检查您的输出API中新的选项卡,并确保它显示XML格式或HTML格式

check your output api in new tab and make sure that it displays the results in XML format or HTML format

第2步:在存储XML或HTML格式副诗句API的结果。

Step 2: Store the api results in XML or HTML format vice-verse..

例如。

$ xmlstr = @file_get_contents($ authentic_api);

$xmlstr = @file_get_contents( $authentic_api );

如果(!$ xmlstr == NULL)

if( !$xmlstr == null )

$ XML =新的SimpleXMLElement($ xmlstr);

$xml = new SimpleXMLElement( $xmlstr );

如果(空($ XML)|| $ XML == NULL)

if( empty($xml) || $xml == null )

返回NULL;

$这个 - > aj_results = $ XML;

$this->aj_results = $xml;

返回$ xml的;

第三步:您解析XML或HTML结果
解析结果来获得所选择的数据。
并将其存储在数组中,并返回值get_result_from_api.php

Step 3 : Parse your xml or html results Parse results to get the selected data. And store it in the array and return values to "get_result_from_api.php"

第4步:打印出来是
使用你需要打印出来的结果的foreach循环,你得到形成包装类..

step 4: Print is out using the foreach loop you need to print out the results that you get form the wrapper class..

希望这件事可以帮助你。

Hope this things helps you out.

由于希望是好东西,也许是最好的东西,并没有好东西会消逝!

这篇关于iTunes Store的API - 按热门程度排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆