[PHP] Reddit Scrapper

Rafay

var nerd; nerd = db_getUser("rafay");
Messages
2,106
Location
Pakistan
Click

It's just a prototype. It will be improved upon quite a bit.

Example subreddits:
  • funny
  • aww
  • WTF
 
Looks cool and could have unlimited potential.

How are you grabbing the data? PHP API/Perl/JSON/Ajax?

Also, you should add in argument checking because when anyone leaves a box missing, PHP cries;

Code:
if(!isset($numofpages) || !isset($redditname))
{
  exit("Please don't make PHP cry :C");
}
 
ToshNeox said:
How are you grabbing the data? PHP API/Perl/JSON/Ajax?
cURL to send authorization headers over to Reddit API and receiving JSON in return; parsed by json_decode().

Like I said, it's just a prototype. I had no experience with cURL and JSON parsing, so this was like a headfirst technique to tackle this. I couldn't get it right for the most part and when I finally did, I was so tired that I yanked bits of code without any proper validation. I have, however, lots of plans for this. Like you said, it has a lot of potential.
 
Yea, I've never really looked into APIs much either, but it's amazing what you can do :troll:
 
Back
Top Bottom