Skip to content

Instantly share code, notes, and snippets.

@diogenesjup
Created March 11, 2025 17:17
Show Gist options
  • Save diogenesjup/19b7026704dbf1b00c58a704ef626298 to your computer and use it in GitHub Desktop.
Save diogenesjup/19b7026704dbf1b00c58a704ef626298 to your computer and use it in GitHub Desktop.
Exemplo CURL
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://diogenesjunior.com.br/api/ia/gpt4/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => 'origem=https%3A%2F%2Fwww.diogenesjunior.com.br&prompt=O que é SSL?',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/x-www-form-urlencoded'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment