Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

255
Views
PHP cURL with Content-Disposition: form-data

I'm getting confuse about this Instagram cURL in converting it into PHP see below:

   curl -F 'client_id=CLIENT_ID' \
    -F 'client_secret=CLIENT_SECRET' \
    -F 'grant_type=authorization_code' \
    -F 'redirect_uri=AUTHORIZATION_REDIRECT_URI' \
    -F 'code=CODE' \
    https://api.instagram.com/oauth/access_token  

here is my current code with an error

{
  "error_type": "OAuthException",
  "code": 400,
  "error_message": "You must provide a client_id"
}

current code with sample value:

$client_id = "7d60c47cdwe249069cdb07a0f28e19cb";
$client_secret = "de5awwe3ebf1443d8dcf0fbc88e5ab1b";
$grant_type = "authorization_code";
$redirect_uri = "http://sexample.net/create-code.php";
$code ="y23d86c19b4c3b0a8b561e64c93f2b3f";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    //format URL to grant access to email and sitename passed
    $data  = '{"client_id":"'.$client_id.'","client_secret":"'.$client_secret.'","grant_type":"'.$grant_type.'","redirect_uri":"'.$redirect_uri.'","code":"'.$code.'"}';
    curl_setopt($ch, CURLOPT_URL, 'https://api.instagram.com/oauth/access_token');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
    //execute cURL call and get template data
    $output = curl_exec($ch);
    curl_close($ch);
    echo $output;
over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!