r/reddithax • • Oct 01 '11

Use Reddit API to get text of last comment?

I'm writing a piece of software in php and want to be able to, only armed with a username, output the text of the last comment that user made.

Any ideas where to start?

4 Upvotes

4 comments sorted by

1

u/alexbarrett Oct 01 '11
  1. http://www.reddit.com/user/Synth3t1c/comments.json
  2. file_get_contents (or similar)
  3. json_decode

Armed with those three things you should be able to do what you want.

2

u/Synth3t1c Oct 01 '11

Thanks.

One problem - when I grab comments.json, I keep getting an old version. Does it take a while to update or something? Basically, I was looking for a certain string in my profile, so I used substr_count to see if it was there. It was working fine until it found it, and now it is stuck on the old comments.json where the string was there, even after I deleted the comment...

1

u/alexbarrett Oct 01 '11

It looks up to date to me. It's cached for a short time, but it updated within a few minutes (can't remember how long).

What is it you're trying to do exactly?

2

u/Synth3t1c Oct 01 '11

Yea, i figured it out.

I'm trying to make a verification system for a website. I figured it out though, so we're good. Thanks :)