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 8273321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:26:17+00:00 2026-06-08T07:26:17+00:00

I am attempting to login to Reddit using their login API – https://github.com/reddit/reddit/wiki/API%3A-login .

  • 0

I am attempting to login to Reddit using their login API – https://github.com/reddit/reddit/wiki/API%3A-login. I am able to successfully authenticate and store a cookie using

$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, 'http://www.reddit.com/api/login/USERNAME');
curl_setopt ($ch, CURLOPT_REFERER, "http://www.reddit.com");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); 
curl_setopt($ch, CURLOPT_POST, 1); 
$postData = 'api_type=json&user=USERNAME&passwd=PASSWORD'; 
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt'); 
curl_exec($ch);

but when I add

curl_setopt($ch, CURLOPT_URL, 'http://www.reddit.com/r/pics');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
echo $data;

to the end of the authentication code I receive the ‘page not found’ page from Reddit, even though I am succesfully logged in and the page seems to indicate that I am indeed in the /r/pics subreddit. I am wondering if there is some sort of redirect happening or if any options are missing or incorrect.

  • 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-08T07:26:19+00:00Added an answer on June 8, 2026 at 7:26 am

    You’d still be performing a POST operation when you load the second URL. CURL will not switch ‘back’ to a GET unless you tell it to. Try adding in

    curl_setopt($ch, CURLOPT_HTTPGET, TRUE);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to login to a cPanel using a POST Request in VB.Net. I
I am attempting to create a very basic login screen, using the Storyboard designer
I am attempting to authenticate users against an existing LDAP server (Active-Directory) using the
I am attempting to access the Google Search Appliance API: http://code.google.com/apis/searchappliance/documentation/612/gdata/acapi_protocol.html In order to
I'm attempting to create a user login for Facebook and Windows LiveId using DotNetOpenAuth
I am attempting to add OpenID login support to a Play Framework application using
I am attempting to login to appengine to app engine and access the User
Attempting to make a NSObject called 'Person' that will hold the login details for
I have been attempting to use ASP.NET MVC remote validation for username login access
I am using Capistrano to deploy a ruby on rails project. I am attempting

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.