百度是php写的吗,用 PHP 写了一个百度提交,结果我就懵了

事情是这样,我看见百度的 JS 自动推送代码,就想用 PHP 也实现一下,成功了,但我忘记百度是第二天才放数据,我去百度站长平台看发现没时间,我就把代码删除了,第二天登录才看见数据,但我已经删除了删除了删除了。。。这两天试着记忆还原代码,无数次失败,现在来求助各位大 V 帮助。。。

---------------------------------------------------------------------

(function(){

var bp = document.createElement('script');

var curProtocol = window.location.protocol.split(':')[0];

if (curProtocol === 'https') {

bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';

}

else {

bp.src = 'http://push.zhanzhang.baidu.com/push.js';

}

var s = document.getElementsByTagName("script")[0];

s.parentNode.insertBefore(bp, s);

})();

-------------------------------------------------------------------------

function baidu($url){

shuffle($url);

$cip = rand_ip();

$header = array(

'CLIENT-IP:' . $cip,

'X-FORWARDED-FOR:' . $cip,

);

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://sp0.baidu.com/9_Q4simg2RQJ8t7jm9iCKT-xh_/s.gif?r='.rawurlencode($url['0']).'&l='.$url['1']);

$cookie_file = dirname(__FILE__).'./baiducookies';

if(is_file($cookie_file)){

curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);

//@unlink($cookie_file);

}else{

curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);

}

curl_setopt($ch, CURLOPT_HTTPHEADER, $header);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

curl_setopt($ch, CURLOPT_REFERER, $url['0']);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.3'.mt_rand(0,88888));

curl_setopt($ch, CURLOPT_TIMEOUT, 8);

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

$contents = curl_exec($ch);

curl_close($ch);

clearstatcache();

unset($contents);

return $url;

}

baidu(array('http://www.baidu.com','http://www.baidu.com'));

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值