<?php
$post_data = array();
$post_data['longUrl'] = "
http://www.baidu.com";
$post_data['note'] = "
baidu.com";
$post_data['private'] = "false";
$post_data['title'] = "Baidu Search engine";
$ch = curl_init('
https://bitly.com/data/beta/save');curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查
curl_setopt($ch, CURLOPT_TIMEOUT, 30);//可不能让我等半天好么
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1); // 从证书中检查SSL加密算法是否存在
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$re=curl_exec($ch);
if (curl_errno($ch)) {
echo 'Errno'.curl_error($ch);//捕抓异常
}
curl_close($ch); // 关闭CURL会
var_dump($re);
https post跟普通的post有点不一样,需要检查证书,url_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);跳过...
还有这个网站有点慢.3秒还一堆超时