PHP code example of ghosh / designernews-php-api

1. Go to this page and download the library: Download ghosh/designernews-php-api 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/ */

    

ghosh / designernews-php-api example snippets


$config = array(
	"accessToken"  => "YOUR_ACCESS_TOKEN"
);

try
{
	$DN = new DesignerNews($config);
}
catch (Exception $e)
{
	echo $e->getMessage();
}

$DN->me();

$DN->getStory($id);
$DN->upvoteStory($id);
$DN->commentOnStory($id, $comment);
$DN->getTopStories();
$DN->getRecentStories();
$DN->searchForStory($queryString);

$DN->getComment($id);
$DN->upvoteComment($id);
$DN->replyToComment($id, $reply);

$DN->getMOTD();
$DN->upvoteMOTD();
$DN->downvoteMOTD();
json
{
    "hosh/designernews-php-api": "~1.0"
    }
}