I'm doing tests with curl_init php
I happen to have the links like this:
http://localhost/produto/novo
Internally it accesses the new.php file, but I'm using htaccess to work with friendly URLs
I need to make a file that will accept queries via curl_init from php that is on another server
If I open the browser and type:
http://localhost/produto/novo?codigo=1
It accepts beauty, that is, the page is operating normally and accepting the parameters.
But if I use this same URL in curl_init it does not accept it, it brings me the index content.
Now if I put the url with the file name it accepts:
$url = http://localhost/produto/novo.php
curl_init only accesses files directly, not to use friendly url on it?
My request:
...
$dados = array("pedidos" => $pedidos, "status" => $status, "loja" => $loja);
$url = "http://123.123.123.123/recebe.transito.php";
AQUI EU GOSTARIA DE COLOCAR A URL AMIGAVEL
$url = "http://123.123.123.123/recebe.transito"; // SEM O .PHP
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt_array($curl, array(CURLOPT_FOLLOWLOCATION => true));
curl_setopt($curl, CURLOPT_POSTFIELDS, $dados);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$res = curl_exec($curl);
//$res = curl_getinfo($curl, CURLINFO_HTTP_CODE); // Pegar o código de resposta
$result = json_decode($res);
....
My .htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]