21,886
社区成员
发帖
与我相关
我的任务
分享
function dwz($url){
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,"http://dwz.cn/create.php");
curl_setopt($ch,CURLOPT_POST,true);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
$data=array('url'=>$url);
curl_setopt($ch,CURLOPT_POSTFIELDS,$data);
$strRes=curl_exec($ch);
curl_close($ch);
$arrResponse=json_decode($strRes,true);
if($arrResponse['status']==0){/**错误处理*/
echo iconv('UTF-8','GBK',$arrResponse['err_msg'])."\n";
}
return $arrResponse['tinyurl'];
}
for($i=1;$i<=10;$i++){
echo "http://zhidao.baidu.com/question/".rand(0,100000)."$i.html----->".dwz("http://zhidao.baidu.com/question/".rand(0,100000)."$i.html")."<br>";
}
function dwz($url){
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,"http://dwz.cn/create.php");
curl_setopt($ch,CURLOPT_POST,true);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
$data=array('url'=>$url);
curl_setopt($ch,CURLOPT_POSTFIELDS,$data);
$strRes=curl_exec($ch);
curl_close($ch);
$arrResponse=json_decode($strRes,true);
if($arrResponse['status']==0){
echo iconv('UTF-8','GBK',$arrResponse['err_msg'])."\n";
}
return $arrResponse['tinyurl'];
}
for($i=1;$i<=10;$i++){
echo "http://zhidao.baidu.com/question/".rand(0,100000)."$i.html----->".url_short("http://zhidao.baidu.com/question/".rand(0,100000)."$i.html")."<br>";
}
大神帮忙看下撒~~~