地址:上海市徐汇区田州路99号凤凰园19号楼902室,联系电话:15317627375
电脑版:www.zhangguangpeng.cn 手机版:http://m.zhangguangpeng.cn
© 2023 - 2024 All Rights Reserved
curl -H 'Content-Type:text/plain' --data-binary @urls.txt "http://data.zz.baidu.com/urls?site=www.zhangguangpeng.cn&token=f8ixxbmS2JxmLNUG"
$urls = array(
'http://www.example.com/1.html',
'http://www.example.com/2.html',
);
$api = 'http://data.zz.baidu.com/urls?site=www.zhangguangpeng.cn&token=f8ixxbmS2JxmLNUG';
$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;
require 'net/http'
urls = ['http://www.example.com/1.html', 'http://www.example.com/2.html']
uri = URI.parse('http://data.zz.baidu.com/urls?site=www.zhangguangpeng.cn&token=f8ixxbmS2JxmLNUG')
req = Net::HTTP::Post.new(uri.request_uri)
req.body = urls.join("\n")
req.content_type = 'text/plain'
res = Net::HTTP.start(uri.hostname, uri.port) { |http| http.request(req) }
puts res.body