PHP code example of suin / php-qiita

1. Go to this page and download the library: Download suin/php-qiita library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

suin / php-qiita example snippets


$qiita = new Qiita(array(
	'username' => 'suin',
	'password' => 'p@ssW0rd',
));

try
{
	// ユーザ情報の取得
	$user = $qiita->api('/users/suin');

	// 投稿の実行
	$createdItem = $qiita->api('/items', 'POST', array(
		'title' => 'Qiita APIからのテスト投稿',
		'tags' => array(
			array('name' => 'Qiita'),
		),
		'body' => 'テスト投稿',
		'private' => false,
	));
}
catch ( Exception $e )
{
	error_log($e);
}