예제 #1
0
<?php

require_once __DIR__ . '/../../vendor/autoload.php';
use Linkorb\AnswersClient\Client;
use Linkorb\AnswersClient\Question;
// get the client
$client = new Client('http://answers.dev/api/v1/', 'kishanio', '11121992');
// Create Question
$question = new Question($client);
$question->setQuestion('asking question 1?');
$question->setDescription('wow question 1');
$question->setTopicId('1');
try {
    $question->create();
} catch (Exception $e) {
    echo $e->getMessage();
}
$question->setQuestion('this is update question?');
try {
    $question->update();
} catch (Exception $e) {
    echo $e->getMessage();
}
예제 #2
0
<?php

require_once __DIR__ . '/../../vendor/autoload.php';
use Linkorb\AnswersClient\Client;
use Linkorb\AnswersClient\Question;
// get the client
$client = new Client('http://answers.dev/api/v1/', 'kishanio', '11121992');
$question = new Question($client);
$question->get(2);
try {
    $question->delete();
} catch (Exception $e) {
    echo $e->getMessage();
}
예제 #3
0
<?php

require_once __DIR__ . '/../../vendor/autoload.php';
use Linkorb\AnswersClient\Client;
use Linkorb\AnswersClient\Question;
// get the client
$client = new Client('http://answers.dev/api/v1/', 'kishanio', '11121992');
$question = new Question($client);
$question->get(16);
try {
    $question->comment('this is some comment');
} catch (Exception $e) {
    echo $e->getMessage();
}
예제 #4
0
<?php

require_once __DIR__ . '/../../vendor/autoload.php';
use Linkorb\AnswersClient\Client;
use Linkorb\AnswersClient\Question as Comment;
// get the client
$client = new Client('http://answers.dev/api/v1/', 'kishanio', '11121992');
$comment = new Comment($client);
$comment->get(6);
$votes = $comment->getVotes();
var_dump($votes);
예제 #5
0
<?php

require_once __DIR__ . '/../../vendor/autoload.php';
use Linkorb\AnswersClient\Client;
use Linkorb\AnswersClient\Question;
// get the client
$client = new Client('http://answers.dev/api/v1/', 'kishanio', '11121992');
$question = new Question($client);
$question->get(8);
$answers = $question->getAnswers();
var_dump($answers);
$comments = $question->getComments();
var_dump($comments);
$votes = $question->getVotes();
var_dump($votes);
예제 #6
0
<?php

require_once __DIR__ . '/../../vendor/autoload.php';
use Linkorb\AnswersClient\Client;
use Linkorb\AnswersClient\Question;
// get the client
$client = new Client('http://answers.dev/api/v1/', 'kishanio', '11121992');
$question = new Question($client);
$question->get(16);
try {
    $question->vote();
} catch (Exception $e) {
    echo $e->getMessage();
}
예제 #7
0
<?php

require_once __DIR__ . '/../../vendor/autoload.php';
use Linkorb\AnswersClient\Client;
use Linkorb\AnswersClient\Question;
// get the client
$client = new Client('http://answers.dev/api/v1/', 'kishanio', '11121992');
// Update question
$question = new Question($client);
$question->get(2);
$question->setQuestion('this is update question for id 2?');
$question->setDescription('this is update question for id 2?');
try {
    $question->update();
} catch (Exception $e) {
    echo $e->getMessage();
}