I would like to know how to use the Stack API and get all questions with a particular tag. I am coding in PHP. So I would like to write a script which can get all questions with a particular tag. I already got an API key but I do not know what to do with it. Thanks in advance!
I would highly recommend using Stack.PHP, a library for the API that I wrote. Writing the code to access the API in PHP yourself will take a considerable amount of time once you add pagination, request throttling, etc. By using Stack.PHP, you needn't worry about any of that.
Now on to your question:
This is very easy with Stack.PHP. For example, to get all of the posts here on Stack Apps with the app tag, you would do the following:
The example above will fetch and display the titles of all of the questions with the app tag. Keep in mind that the code above will fetch as many pages as necessary to get all of the questions - if you only want the first page, pass
Your app can make up to 300 requests without a key (like in the example above) but this number increases to 10,000 with an API key. You can provide Stack.PHP with your API key running this line before making any requests:
If you are interested in using Stack.PHP, you can download the latest version (0.5 beta 1) here. The archive consists of the source code, documentation, examples, and test suite. The source code is in the
If you want some help getting started, check out my tutorial here:
...and be sure to check out the Stack.PHP website stackphp.quickmediasolutions.com.