a reddit-php-sdk method not outputting anything

淺唱寂寞╮ 提交于 2019-12-24 00:10:20

问题


I'm trying to learn reddit code and using this https://github.com/jcleblanc/reddit-php-sdk

There's a method in this library $reddit->getUser() which outputs null always. Everything else seems to be working though.

include_once("jcleblanc-reddit-php-sdk-4a4cc32/reddit.php");
$reddit = new reddit("my-username", "my-password");
$userData = $reddit->getUser();
var_dump($userData);

outputs null.

$response = $reddit->getListing("all", 5);
var_dump($response);

outputs what's expected just fine. Then what could be going wrong with $reddit->getUser()?


回答1:


this is Jonathan LeBlanc, I created that library. I'm running tests right now and I don't seem to be seeing the same issues. This is the code I'm running with the library:

<?php
require_once("reddit.php");

$reddit = new reddit("USERNAME", "PASSWORD");
var_dump($reddit->getUser());
?>

When running that, I am seeing my user data object coming through. Are you still experiencing this issue?

  • Jon


来源:https://stackoverflow.com/questions/12810166/a-reddit-php-sdk-method-not-outputting-anything

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!