我使用Curl
从我的网站上获取数据。数据以HTML Table
格式提取。那么如何正确保存CSV
格式的数据
<?php
$url = 'http://etea.edu.pk/result_controller';
$ch = curl_init();
$ch = curl_init($url);
$params = [
'search_res' => true,
'search_value' => 108,
'result_id' => 272,
];
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
$result = curl_exec($ch);
curl_close($ch);
$file = fopen("contacts.csv","w");
fputcsv($file,explode(',',$result));
fclose($file);
?>