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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:02:27+00:00 2026-06-14T20:02:27+00:00

Hey there I am started to learn foursquare API, but I am stuck at

  • 0

Hey there I am started to learn foursquare API, but I am stuck at getting an Access Token.
Here is a part from the code I found in SO.

        // build url
    $url = 'https://foursquare.com/oauth2/access_token';
    $url .= '?client_id='.CLIENT_ID;
    $url .= '&client_secret='.CLIENT_SECRET;
    $url .= '&grant_type=authorization_code';
    $url .= '&redirect_uri=**********/callback'; //change to your 4sq callback
    $url .= '&code='.$code;

    // call to https://foursquare.com/oauth2/access_token with $code
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_URL, $url);
    $result = curl_exec($ch);

However this did not work, so I have tried to find error. First echoed $url and manually clicked on that link. It worked, foursquare has returned me an access token in json format. So the problem is in the curl part of the code.

Can you find my error? and more importantly can you suggest me some resources to study on curl?

EDIT:
I did a var_dump($result) and the output is ‘boolean false’

  • 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-14T20:02:29+00:00Added an answer on June 14, 2026 at 8:02 pm

    The problem is http*s*, try adding these:

    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hey there i have this code that should save a file from sql server
hey there, Im having problems displaying my results in this program but the program
Hey there, So I'm knocking together a random pattern generation thing. My code so
Hey there I have just started Java for a course I will be taking
Hey there stack overflow enthusiasts. I am getting this mixed content warning in Internet
Hey there, assuming I have the following code in a mex routine: mxArray *newPoint
Hey there, I have read the few posts here on when/how to use the
Hey there I am trying to learn SQL by trying to complete online questions
Hey there, I've started to play around with Fluent NHibernate and now I want
Hey everyone! Started programming with Bluetooth on Android awhile ago. But now I've run

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.