主动推送脚本
使用说明:
1.将sm.html和sm.php上传网站根目录;
2.访问---你的域名/sm.html;
3.然后输入你需要提交的url即可提交。
sm.html源码:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>教你主动实时推送</title>
</head>
<body>
<h1 style="width:80%;font-size:20px;line-height:32px; font-family:Georgia, 'Times New Roman', Times, serif;color:#F00;">温馨提示:<br>(适用百度实时推送。一个链接占用一行,不要出现空格。推送成功会提示{"remain":*,"success":*})</h1>
<!--表单-->
<form action="sm.php" method="post">
<textarea name="url" cols="" rows="15" style="width:80%;font-size:24px;line-height:32px; font-family:Georgia, 'Times New Roman', Times, serif;padding:20px;border:5px dashed #6C0;">
</textarea><br><br>
<div style="text-align:center;"><input name="" type="submit" value="提交" style="width:200px;height:88px;font-size:48px;cursor:pointer;color:#F00"></div>
</form>
</body>
</html>
sm.php源码:
<?php
$str = $_POST['url'];
$urls = explode(" ",$str);
$api = 'http://data.zz.baidu.com/urls?site=www.yefanseo.com&token=1Sv2dknfaFQ6PgmR';
$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;
?>
发表评论 取消回复