这是他们的案例,
$api = 'http://data.zz.baidu.com/urls?site=https://www.ougulun.com&token=aY5FTw2Djsac7TaO';
这里面的urls和上面的$urls好像没关系吧?这块需要怎么传?
$urls = array(
'http://www.example.com/1.html',
'http://www.example.com/2.html',
);
$api = 'http://data.zz.baidu.com/urls?site=https://www.ougulun.com&token=aY5FTw2Djsac7TaO';
$ch = curl_init();
$options = array(
CURLOPT_URL => $api,
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => implode("\n", $urls),
CURLOPT_HTTPHEADER => array('Content-Type: text/plain'),
);
curl_setopt_array($ch, $options);
$result = curl_exec($ch);
echo $result;