谁有PBOOT的配图、百度推送、必应推送插件啊?

查看 36|回复 1
作者:seoike.com   
1)curl推送示例
将要提交的url数据写入一个本地文件,比如urls.txt,每个url占一行,然后调用curl命令:
curl -H 'Content-Type:text/plain' --data-binary @urls.txt
"http://data.zz.baidu.com/urls?site=www.example.com&token=edk7yc4rEZP9pDQD"
使用php、python、java等可以参照这个过程推送结构化数据。
2)post推送示例
POST /urls?site=www.58.com&token=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.html
3)php推送示例
$urls = array(
    'http://www.example.com/1.html',
    'http://www.example.com/2.html',
);
$api = 'http://data.zz.baidu.com/urls
site=www.58.com&token=edk7ychrEZP9pDQD';
$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;
4)ruby推送示例
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.xxx.com&token=eTk7ychrWZP1pDQD')
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

示例, 插件

loren   


啥都要
您需要登录后才可以回帖 登录 | 立即注册

返回顶部