I have a code where I send data via cURL
to another page inside the server, but I have a problem ... When sending this data to the other page, it inserts into MySQL only when viewing the record inserted in the MySQL all words after any accent goes blank. For example, if I send Programming in MySQL just enter Program the rest will not send.
cURL.php
<?php
header('Content-Type: application/json; charset=utf-8');
$ch = curl_init();
extract($_POST); //Recebe do $.post() do jQuery
$data = array('dados'=>array('nome'=>$nome, 'tipo'=>$tipo));
curl_setopt($ch, CURLOPT_URL, "http://localhost/app2/api/api.php");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$output = curl_exec($ch);
echo json_decode($output);
curl_close($ch);
?>
api.php
<?php
...
$dados = $_POST["dados"];
$nome = $dados["nome"];
$tipo = $dados["tipo"];
$insere = mysql_query("INSERT INTO tabela VALUES (NULL, '".$nome."', '".$tipo."')");
...
?>