Hello,
`
$url='https://xxxxxx='.$data;
$contents = file_get_contents($url);
$json_data = json_decode($contents);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, false);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$res = curl_exec($ch);
$customers[] = $res;
$err = curl_error($ch);
$contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
//echo $contentType;
curl_close($ch);
if ($err) {
echo "cURL Error #:" . $err;
}
else {
echo $res;
`
I post with PHP cURL, a SQL query "SELECT * FROM customers"and I retrieve the following string :
Nom Prenom email
SUXXX JEAN-BAPTISTE xxx@xxx94.com
PINXXX LAURENT xxx@gmail.com
EXCXXX EVELYNE xxx@bbox.fr
How can I extract the data to post them to another remote server ?
How can I fetch the data in json ?
How can I convert this string in a associative array ?
Thank you in adance