1

ユーザーがクエリを実行してデータを取得できる YQL のような API を PHP で作成したいと考えています。これを達成する方法を教えてください。非常に基本的なクエリから始めることができます。PHP と MYsql でこれを達成する方法についてのガイダンスが必要ですか?

4

1 に答える 1

-1

理解を深めるために、これをコピーしてここに貼り付けます。これを表示する人は、質問のサンプルアプローチとして取り上げます。

これはyqlのmysqlのようなコマンドです

**

select * from html where url="http://finance.yahoo.com/q?s=yhoo" and
      xpath='//div[@id="yfi_headlines"]/div[2]/ul/li/a'

**

 <?xml version="1.0" encoding="UTF-8"?>
    <query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng"
        yahoo:count="15" yahoo:created="2016-01-11T17:09:07Z" yahoo:lang="en-US">
        <diagnostics>
            <publiclyCallable>true</publiclyCallable>
            <url execution-start-time="1" execution-stop-time="1228" execution-time="1227"><![CDATA[http://finance.yahoo.com/q?s=yhoo]]></url>
            <url execution-start-time="1" execution-stop-time="1228" execution-time="1227"><![CDATA[http://finance.yahoo.com/q?s=yhoo]]></url>
            <user-time>1231</user-time>
            <service-time>2445</service-time>
            <build-version>0.2.369</build-version>
        </diagnostics> 
        <results>
            <a data-ylk="cp:American City Business Journals;o:e;" href="http://us.rd.yahoo.com/finance/external/bizj/SIG=139c9j4lb/*http://www.bizjournals.com/sanjose/news/2016/01/11/yahoo-staff-are-losing-faith-in-the-company-and.html?ana=yahoo">Yahoo staff are losing faith in the company and its leadership</a>
            <a data-ylk="cp:Zacks;o:i;" href="http://finance.yahoo.com/news/technology-stock-roundup-dismal-start-150703080.html">Technology Stock Roundup: Dismal Start to 2016</a>
            <a data-ylk="cp:Forbes;o:e;" href="http://us.rd.yahoo.com/finance/external/forbes/SIG=14082so2n/*http://www.forbes.com/sites/ericjackson/2016/01/11/want-an-instant-2-5-million-bonus-at-yahoo-allegedly-just-threaten-to-quit/?utm_campaign=yahootix&amp;partner=yahootix">Want An Instant $2.5 Million Bonus At Yahoo? Allegedly, Just Threaten To Quit</a>
            <a data-ylk="cp:Barrons.com;o:e;" href="http://us.rd.yahoo.com/finance/external/barrons/SIG=13cgi999q/*http://blogs.barrons.com/techtraderdaily/2016/01/11/yahoo-talk-of-core-sale-in-focus-again-on-nyt-article/?mod=yahoobarrons&amp;ru=yahoo">Yahoo! Talk of 'Core' Sale in Focus Again on NYT Article</a>
            <a data-ylk="cp:Insider Monkey;o:e;" href="http://us.rd.yahoo.com/finance/external/xinsidermonkey/SIG=14d3lit34/*http://www.insidermonkey.com/blog/a-look-at-whitebox-advisors-top-equity-holdings-as-it-prepares-to-close-down-its-mutual-fund-unit-405548/">A Look At Whitebox Advisors Top Equity Holdings As It Prepares To Close Down Its Mutual Fund Unit</a>
            <a data-ylk="cp:Bloomberg;o:i;" href="http://finance.yahoo.com/video/yahoo-said-reconsider-business-sale-142447099.html">Yahoo Said to Reconsider Web Business Sale, Why?</a>
            <a data-ylk="cp:Bloomberg;o:e;" href="http://us.rd.yahoo.com/finance/external/bloomberg/SIG=131lr1djm/*http://www.bloomberg.com/news/videos/2016-01-11/yahoo-said-to-reconsider-web-business-sale-why-?cmpid=yhoo.headline">Yahoo Said to Reconsider Web Business Sale, Why?</a>
            <a data-ylk="cp:CNBC;o:i;" href="http://finance.yahoo.com/video/twitter-shares-down-48-past-134500309.html">Twitter shares down 48% in past year</a>
            <a data-ylk="cp:CNBC;o:e;" href="http://us.rd.yahoo.com/finance/external/cnbc/SIG=112isi8k7/*http://www.cnbc.com/id/103294156?__source=yahoo%7cfinance%7cheadline%7cheadline%7cstory&amp;par=yahoo&amp;doc=103294156">Early movers: BXLT, AEO, HSY, M, APOL, WSM &amp; more</a>
            <a data-ylk="cp:Benzinga;o:i;" href="http://finance.yahoo.com/news/bob-peck-yahoo-separation-bulk-123554615.html">Bob Peck On Yahoo: Separation Is Bulk Of Value</a>
            <a data-ylk="cp:Fox Business Video;o:i;" href="http://finance.yahoo.com/video/time-marissa-mayer-yahoo-ceo-120443101.html">Time for Marissa Mayer to go as Yahoo CEO?</a>
            <a data-ylk="cp:The Wall Street Journal;o:e;" href="http://us.rd.yahoo.com/finance/external/wsj/SIG=134mdgf4d/*http://www.wsj.com/articles/cmo-today-apple-news-falls-short-of-publishers-expectations-1452513606?mod=yahoo_hs">CMO Today: Apple News Falls Short of Publishers' Expectations</a>
            <a data-ylk="cp:Quartz;o:i;" href="http://us.rd.yahoo.com/finance/external/quartz/SIG=12kug5d3h/*http://qz.com/590363/yahoos-plan-a-b-c-d-and-e-for-appeasing-frustrated-investors/?utm_source=YPL">Yahoo’s plan A, B, C, D, and E for appeasing frustrated investors</a>
            <a data-ylk="cp:Bloomberg;o:e;" href="http://us.rd.yahoo.com/finance/external/bloomberg/SIG=136qrbvv6/*http://www.bloomberg.com/news/videos/2016-01-09/yahoo-s-web-business-bloomberg-west-full-show-01-08-?cmpid=yhoo.headline">Yahoo's Web Business: Bloomberg West (Full Show 01/08)</a>
            <a data-ylk="cp:Bloomberg;o:i;" href="http://finance.yahoo.com/video/yahoo-considering-sale-core-biz-234206699.html">Yahoo Considering Sale of Core Biz After Activists’ Push</a>
        </results>
    </query>

理解を深めるために、このリンクにアクセスしてください。

于 2016-01-11T17:15:57.100 に答える