Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/afilini/askfmapi
Ask.fm php api
https://github.com/afilini/askfmapi
api-client fm-api php php-integrator
Last synced: about 1 month ago
JSON representation
Ask.fm php api
- Host: GitHub
- URL: https://github.com/afilini/askfmapi
- Owner: afilini
- License: mit
- Created: 2014-07-18T17:47:17.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-07-24T14:14:59.000Z (over 10 years ago)
- Last Synced: 2024-04-20T07:09:47.014Z (7 months ago)
- Topics: api-client, fm-api, php, php-integrator
- Language: PHP
- Size: 203 KB
- Stars: 10
- Watchers: 6
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Ask.fm API
==========Introduction
------------This is an unofficial PHP API for ask.fm.
Features
--------- Asking questions, anonymously or with an account
- Fetching open questions for a profile
- Answering questions
- Deleting questionsIntroduction
------------The libraries are contained in `ask.php`. To use the API, simply write
require('ask.php');
at the top of your file. Note that both `ask.php`and `simple_html_dom.php` are required.`ask.php` defines the `class` `AskFm`. It exposes these properties:
class askFm {
public $lastError;
public function __construct($cookieFile = "cookies.txt") {
}
public function ask($nickname, $question, $anon = false) {
}
public function login($nickname, $password){
}
public function logout() {
}
public function fetchQuestions() {
}
public function checkQuestion($questionId){
}
public function answer($questionId, $text){
}
public function delete($questionId){
}
public function deleteAll(){
}
}The Ask object
--------------To use the API you must declare a `new AskFm` object, like this:
$ask = new AskFm;
lastError
---------When using the API, you might run into errors, eg. when trying to fetch questions without having logged in first. In such cases, the function causing the error will return `false` and store the latest error in `$ask->lastError`.
Logging in
----------In order to use some features, you need to log into your ask.fm account. Use the `login($username, $password)` function.
$ask->login('nickname', 'password');
Asking questions
----------------To ask questions, use `ask($nickname, $question, $anon = false)`. By default, questions will be asked using your account; if you wish to ask questions anonymously, pass `true` as the third parameter.
$ask->ask('afilini', 'How are you?');
$ask->ask('afilini', 'How are you?', true); // Same as above, but anonymouslyFetching questions
------------------To fetch open (i.e. unanswered) questions for your account, use `fetchQuestions()`. The result is an array whose keys are question IDs, and whose values are question texts.
This function returns `false` if an error occurs; see the `lastError` paragraph for more informations on error handling.$questions = $ask->fetchQuestions();
Answering questions
-------------------To answer an open question on your account, use `answer($questionId, $text)`.
$ask->answer('123', 'I'm fine, thanks!');
Deleting questions
------------------To delete a single question, use `delete($questionId)`; to delete all questions, use `deleteAll()`.
$ask->delete('123');
$ask->deleteAll();
Acknowledgements
------This library uses simple_html_dom, by Jose Solorzano: http://sourceforge.net/projects/simplehtmldom/
This library was written by afilini.
This README was written by CapacitorSet.