Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9136835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:00:24+00:00 2026-06-17T09:00:24+00:00

I am pretty new to Php and I try to write some code that

  • 0

I am pretty new to Php and I try to write some code that will scrape images from reddit.

Right off the bat I have a problem. When I execute this code reddit wants to confirm that I am over 18, which makes sense because its a NSFW subreddit. Not sure where to go from here.

Any input is appreciated, I am not looking for someone to copy/paste the required code I would like to learn, thank you!

The reason I am trying to login is so I can validate that I am over 18 automatically through my session.

<?php

$ch = curl_init();

$data = array('user' => 'xxxx', 'passwd' => 'xxxx', 'rem' => TRUE);

curl_setopt($ch, CURLOPT_URL, 'http://www.reddit.com/api/login');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_COOKIEFILE, 'Cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEJAR, 'Cookie.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_exec($ch);

$url = 'http://reddit.com/r/ass';

$page = file_get_contents($url);

var_dump($page);

?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:00:25+00:00Added an answer on June 17, 2026 at 9:00 am

    If you want to retrieve a list of posts for a subreddit, you’ll be better off by retrieving the list of posts formatted as JSON instead of the regular HTML. Postfix the URL to the subreddit with .json and decode it to PHP structures by using json_decode(). For an added bonus you won’t need to confirm you’re over 18 to retrieve the content.

    Example

    This doesn’t answer your question, but it solves your problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm pretty new to PHP, but I decided to try and make a simple
I'm pretty proficient in PHP, but want to try something new. I'm also know
Right, i'm new to PHP and mySQL, but i've got a few questions that
I am pretty new to PHP and MySQL and I just can't figure this
I am still pretty new to PHP so forgive me if I am overlooking
I am pretty new to PHP and I am trying to make an inventory
I'm pretty new to PHP and have a String which contains an HTML page.
I'm currently trying out Aptana Studio 3 for PHP development (I'm pretty new to
I've done a fair bit of mysql php programming but am pretty new to
I'm new to php world (actually not so much, but pretty much). I make

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.