Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

247
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda