1)curl推送示例
將(jiāng)要提交的url數據寫入一個本地文件,比如urls近車.txt,每個url占一行,然後(hòu)調用c銀理url命令:
curl -H 'Content-Type:text/pl現會ain' --data-binary @urls.txt
"http://data.zz.baidu.com/ur農錢ls?site=www.example.答在com&token=edk7yc4rEZP9pDQD"
使用php、python、java等可麗水以參照這(zhè)個過(guò)程推送結構化數據。女路
2)post推送示例
POST /urls?site=www.58.com&toke下裡n=edk7ychrEZP9pDQD HTTP/明農1.1
User-Agent: curl/7.12見時.1
Host: data.zz.baidu.com
Content-Length: 83
http://www.example.com/1.雪相html
http://www.example.com/2.htm如中l
3)php推送示例
$urls = array(
'ht公師tp://www.example.com/1.html',
'http:學土//www.example.com/2.html話鐵',
);
$api = 'http://data.zz.baidu.com算是/urls
site=www.58.com&畫務;token=edk7ychrEZP9跳歌pDQD';
$ch = curl_init();
$options = array(術師
CURLOPT_URL時樂 => $api,
CURLOPT_POST => true,
著秒 CURLOPT_RETURNTRANSFER => true,
C費唱URLOPT_POSTFIELDS => implode("\n",資們 $urls),
CURLOPT_HT通刀TPHEADER => array('Content-Type: text/p站信lain'),
);
curl_setopt_array(放火$ch, $options);
$result = curl_exec($ch);
echo $result;
4)ruby推送示例
require 'net/http'
urls = ['http://www.相村example.com/1.html',近服 'http://www.example.做用com/2.html']
uri = URI.parse('h地公ttp://data.zz.baidu.com/url如化s
site=www.xxx.com&am唱村p;token=eTk7ychrWZP1pDQD房愛')
req = Net::HTTP::Post.new(uri.requ說我est_uri)
req.body = urls.join("\n")
req.content_typ志道e = 'text/plain'
res = Net::HTTP.start(uri.h來和ostname, uri.port) { |http| http.requ高低est(req) }
puts res.body
網站無須三方授權 · 安全穩定、維護方便