Reddit api sdk doing nothing, returns null

不打扰是莪最后的温柔 提交于 2019-12-08 21:03:31

A subreddit post will return null, based on my experience with the code from jcleblanc. His code is not working when i pulled it, but another person fixed it. Pull this https://github.com/markdavison/reddit-php-sdk/commit/2c2eac7f2202720e3fbb80b1ef48c87a6a213ff6

Then run that code. Except you are missing the getuser function which is required at all calls to the reddit api.

Other calls will return data, such as getlisting, etc and you will see posts submitted and the commands working.

If you need code, please ask as I have all basic functions coded.

Here is my subreddit code call with the git hub changes

ioudas@centralmainedesigns:~/centmedes/wordpress/reddit-php-sdk$ cat submitstory.php
<?php
require_once("reddit.php");
$reddit = new reddit();
$userData = $reddit->getUser();
$title = "MakerBot test 3 Releases IPad App For Easy 3D Printing";
$link = "http://makezine.com/greg";
$subreddit = "cbtest";
$response = $reddit->createStory($title, $link, $subreddit);
var_dump($response);
?>
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!