0
I’m trying to send PHP data through CURL to the Protheus service, which receives a string.
I’m having trouble referencing the data to the variable.
Example in PHP:
$response2 = '[{"A1_COD":"'.$row['CLI_PROTHEUS'].'",';
$response2 .= '"A1_PESSOA":"'.$row['CLI_PESSOA'].'",';
$response2 .= '"A1_CGC":"'.$row['CLI_CGC'].'",';
$response2 .= '"A1_NOME":"'. $row['CLI_NOME'].'",';
$url = 'http://blabla/REST01/ADRESTCR1/putcli';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, '**dadosCli**='.$response2);
$result = curl_exec($ch);
curl_close($ch);
The problem is to pass the parameter, the URL should be http://blabla/REST01/ADRESTCR1/putcli?dadosCli=VALORES
This is the problem.... if I send everything directly in the URL, it gives that conversion problem because of accents and spaces.
Does anyone have any light??? the problem is to pass the parameter that needs to receive the value.
You need to make a POST request and the fields will be sent by URL?
– Woss
Exactly Anderson, pass the value to the "dataCli" parameter of the URL
– Dih Centioli