james
james

Reputation: 225

Making php function to get data

I am trying to collect popular keyword data by using a search engine API.

They support Get method to receive data.

If I send a query like this I can get pouplar keyword data.

    <form action='https://openapi.example.com/OApi/RestApiSSL/NC/300010/HotKeyWord/v1   ' method='GET'>
        <div> 
            Oauth<input type='text' name='oauth_consumer_key' value='d029d563644872e08e4e2e40042b8cbceff'>
        </div>
        <div>
            category <input type='text' name='category' value='daykeyword'>
        </div>
        <div>
            count <input type='text' name='count' value='10'>
        </div>
        <div>
            <input type='submit' value='submit'>
        </div>
    </form>

What I want to do is that I want to make a php function and recieve data for every hour.

First, I need to make PHP function.

which php command do I have to use for sending input values and getting GET data?

Upvotes: 0

Views: 1547

Answers (2)

Jeroen
Jeroen

Reputation: 13257

This should work:

$file = file_get_contents('https://openapi.example.com/OApi/RestApiSSL/NC/300010/HotKeyWord/v1?oauth_consumer_key=d029d563644872e08e4e2e40042b8cbceff&category=daykeyword&count=10');

You can just add the GET values to the query string using ?key=value&key2=value2

Upvotes: 2

slash197
slash197

Reputation: 9034

Look in to cURL http://php.net/manual/en/book.curl.php

Upvotes: 0

Related Questions