开启辅助访问 切换到宽版

精易论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

用微信号发送消息登录论坛

新人指南 邀请好友注册 - 我关注人的新帖 教你赚取精币 - 每日签到


求职/招聘- 论坛接单- 开发者大厅

论坛版规 总版规 - 建议/投诉 - 应聘版主 - 精华帖总集 积分说明 - 禁言标准 - 有奖举报

查看: 4013|回复: 6
收起左侧

[已解决] get获取页面内容

 关闭 [复制链接]
结帖率:79% (22/28)
发表于 2013-12-14 12:18:56 | 显示全部楼层 |阅读模式   吉林省通化市
20精币
http://www.f2pool.com/user/worker  获取这个页面“20分钟平均速度”的内容

登录用户名232027@qq.com密码config123


和平时get访问网页不同,获取不到我想要的数据。

123.png

最佳答案

查看完整内容

访问那个地址,需要附加协议头,你展开网页访问的参数可以看到,你把下面的协议头放到常量里面 然后在网页访问里面的附加协议头,写这个常量 x-requested-with: XMLHttpRequest Accept-Language: zh-cn Referer: http://www.f2pool.com/user/worker Accept: */*

求助知识:请将问题描述清楚,最好把你有问题的源码打包上传上来,这样更方便大家帮助你。
友情提醒:本版被采纳的主题可在 申请荣誉值 帖子申请荣誉值,获得 3点 荣誉值,荣誉值可兑换荣誉会员、终身vip用户组。

结帖率:100% (11/11)

签到天数: 16 天

发表于 2013-12-14 12:18:57 | 显示全部楼层   重庆市重庆市
sxklwhy 发表于 2013-12-14 14:46
代码我传上来了,帮我看看。

访问那个地址,需要附加协议头,你展开网页访问的参数可以看到,你把下面的协议头放到常量里面
然后在网页访问里面的附加协议头,写这个常量

x-requested-with: XMLHttpRequest
Accept-Language: zh-cn
Referer: http://www.f2pool.com/user/worker
Accept: */*

评分

参与人数 1荣誉 +3 收起 理由
笨潴 + 3 热心帮助他人,荣誉+3,希望继续努力(*^__^*) 嘻嘻

查看全部评分

回复

使用道具 举报

结帖率:100% (3/3)
发表于 2013-12-14 12:19:42 | 显示全部楼层   福建省厦门市
沙发。。;。
回复

使用道具 举报

结帖率:100% (11/11)

签到天数: 16 天

发表于 2013-12-14 12:38:56 | 显示全部楼层   重庆市重庆市
http://www.f2pool.com/user/worker?action=load

上面的是地址,get后返回下面的内容,自己提取吧

{"status": "ok", "data": [{"rejected_percent": "3.7%", "rejected": 89, "currency": "LTC", "worker_name": "shaoxianju.1", "last_share": 1386994370.470492, "accepted": 2291, "hashrate": "0.0 Khash/s"}, {"rejected_percent": "0.0%", "rejected": 0, "currency": "LTC", "worker_name": "shaoxianju.ff", "last_share": 0, "accepted": 0, "hashrate": "0.0 Khash/s"}]}
回复

使用道具 举报

结帖率:79% (22/28)
 楼主| 发表于 2013-12-14 14:42:59 | 显示全部楼层   吉林省通化市
返回文本 = 到文本 (网页_访问 (“http://www.f2pool.com/user/worker?action=load”))

返回的文本不是你上面写的那些,而是:


* <!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>矿工管理 - F2Pool</title>
<link rel="stylesheet" href="/static/css/bootstrap.min.css?v=39e39c0a6ca35ceca9dd4c82ec878ad6" type ="text/css">
<link rel="stylesheet" href="/static/css/elusive-webfont.css?v=57bd934bc16edccc37a90c365016734f" type ="text/css">
<link rel="stylesheet" href="/static/css/docs.css?v=f8e4050e9072e143fcc28a5040b063db" type ="text/css">
<!--[if lt IE 9]><script src="/static/js/html5.js?v=69431f1ec831bacf31013dff2872cba0"></script><![endif]-->
<script type="text/javascript" src="/static/js/jquery-1.9.1.min.js?v=397754ba49e9e0cf4e7c190da78dda05"></script>

</head>
<body data-spy="scroll" data-target=".bs-docs-sidebar">
<header>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container-fluid">
<button type="button" class="btn btn-navbar collapsed" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="brand" href="/">F2Pool <sup>BETA</sup></a>
<div class="nav-collapse in collapse" style="height:auto;">
<ul class="nav nav-pills">
<li class="divider-vertical"></li>


<li>

<a id="action-home" href="/user/home">我的首页</a>
</li>

<li class="active">

<a id="action-worker" href="/user/worker">矿工管理</a>
</li>

<li>

<a id="action-history" href="/user/history">付款记录</a>
</li>
<li class="divider-vertical"></li>


<li>

<a id="action-help" href="/help">帮助</a>
</li>
<li class="divider-vertical"></li>
<li><a href="http://ptspool.com/" target="_blank">转至 PTS 矿池</a></li>
</ul>
<ul class="nav nav-pills pull-right">

<li class="dropdown">
<a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-user"></i> zddx <strong class="caret"></strong></a>
<ul class="dropdown-menu">
<li><a id="action-account" href="/user/account">账户设置</a></li>
<li><a id="action-logout" href="/user/logout">登出</a></li>
</ul>
</li>

</ul>
</div><!--.nav-collapse -->
</div>
</div>
</div>
</header>
<section>

<div class="row-fluid" style="margin-top: 30px;">
<div class="span10 offset1">
<div class="row-fluid">
<span class="pull-left lead"><strong>矿工管理</strong></span>
<div id="actions" class="btn-group pull-right" data-toggle="buttons-radio">
<button id="action-load-all" type="button" class="btn btn-primary active">全部</button>

<button id="action-load-btc" type="button" class="btn btn-primary">BTC</button>

<button id="action-load-ltc" type="button" class="btn btn-primary">LTC</button>

</div>
</div>
<div class="row-fluid">
<table id="worker-list" class="table table-bordered table-striped">
<thead>
<tr>
<th style="text-align: center;">矿工</th>
<th class="span3" style="text-align: center;">币种</th>
<th style="text-align: center;">20分钟平均速度</th>
<th style="text-align: center;">接受数</th>
<th style="text-align: center;">拒绝数</th>
<th style="text-align: center;">拒绝率</th>
<th style="text-align: center;">最近提交时间</th>
<th class="span2" style="text-align: center;"><input type="checkbox"></th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
<div class="row-fluid" style="text-color: #666666;">
使用采矿软件连接至 stratum+tcp://stratum.f2pool.com BTC 端口 3333 LTC 端口 8888 以“zddx”或“zddx.矿工名”并任意密码开始采矿即可自动创建矿工。矿工名须由数字或小写字母组成,最长15个字符。除非您连接了8888端口,否则新建的矿工默认为BTC矿工,如果您需要其它币种,请注意在本页更改。如果您收到大量“H-not-zero”或“high-hash”的错误信息,请检查币种是否匹配。如果您无法连接至3333或8888端口,也可以尝试25端口。
</div>
</div>
</div>

</section>
<footer class="footer">
<div class="container">
<p>?2013 F2Pool 版权所有</p>
<ul class="footer-links">
<li><a href="/help">帮助说明</a></li>
<li class="muted">·</li>
<li><a href="mailto:admin@f2pool.com">客服邮箱</a></li>
<li class="muted">·</li>
<li style="color: #777777;">QQ群:<!--195522655 105890190 309497457 280277743 264727715--> 316737698</li>
<li class="muted">·</li>
<li><a href="http://weibo.com/u/3353401212">新浪微博</a></li>
</ul>
<p>浙ICP备12045611号-1</p>
</div>
</footer>
</body>
<script src="/static/js/docs.js?v=38a9ace7f49a5103f5bf54ad71e6c3b8"></script>
<script src="/static/js/bootstrap.min.js?v=8497dc2e634e9d9d5ab44249b96c39fb"></script>
<script src="/static/js/jquery.dialog2.js?v=d3a2e326ac4be7ef939f37d1a6957116"></script>
<script src="/static/js/jquery.dialog2.helpers.js?v=466f7281ec63abd1f541fcc904be0cb0"></script>
<script src="/static/js/jquery.placeholder.js?v=aef73c3cd7cb8e182f674dd970831ab3"></script>
<script type="text/javascript">$(function() { $('input, textarea').placeholder(); })</script>

<script type="text/javascript">
<!--
var _$t, _$tb, _$th;
function _tr(worker) {
worker.last_share = worker.last_share > 0 ? formatTimestampUptoMinute(worker.last_share) : '';
return $('<tr>' +
' <td style="text-align: center;">' + worker.worker_name + '</td>' +
' <td class="currency" data-currency="' + worker.currency + '" style="text-align: center;">' +
worker.currency +
' <a id="action-change-currency" style="margin-left: 5px;" href="javascript: void(0);"><i class="icon-edit"></i></a>' +
' </td>' +
' <td style="text-align: center;">' + worker.hashrate + '</td>' +
' <td style="text-align: center;">' + worker.accepted + '</td>' +
' <td style="text-align: center;">' + worker.rejected + '</td>' +
' <td style="text-align: center;">' + worker.rejected_percent + '</td>' +
' <td style="text-align: center;">' + worker.last_share + '</td>' +
' <td style="text-align: center;"><input type="checkbox"></td>' +
'</tr>').data('worker', worker);
}
function _tr_operation() {
return $('<tr id="tr-operation">' +
' <td colspan="7" style="text-align: center;"></td>' +
' <td style="text-align: center; width: auto;">' +
' <select id="select-operation" style="width: 100px;">' +
' <option value="0">请选择...</option>' +
' <option disabled="disabled">----------</option>' +
' <option value="1">新建矿工</option>' +
' <option disabled="disabled">----------</option>' +
' <option value="2">修改币种</option>' +
' <option disabled="disabled">----------</option>' +
' <option value="3">移除矿工</option>' +
' </select>' +
' </td>' +
'</tr>');
}
function _tr_new() {
return $('<tr id="tr-insert">' +
' <td style="text-align: center;">' +
' zddx.<input id="input-worker-name" type="text">' +
' </td>' +
' <td style="text-align: center;">' +
' <select id="select-currency" style="width: 100px;">' +

' <option value="bitcoin">BTC</option>' +

' <option value="litecoin">LTC</option>' +

' </select>' +
' </td>' +
' <td></td>' +
' <td></td>' +
' <td></td>' +
' <td></td>' +
' <td></td>' +
' <td>' +
' <ul class="cell-links">' +
' <li><a id="action-submit-insert" href="javascript: void(0);"><i class="icon-ok-sign"></i></a></li>' +
' <li><a id="action-cancel-insert" href="javascript: void(0);"><i class="icon-minus-sign"></i></a></li>' +
' </ul>' +
' </td>' +
'</tr>');
}
function _f(workers) {
_$tb.empty();
if (workers.length == 0) {
_$tb.append(_tr_operation());
}
else {
for (var i=0; i < workers.length; ++i) {
_$tb.append(_tr(workers));
}
_$tb.append(_tr_operation());
}
}
function _l_all() {
$.ajax({
type: 'GET',
url: '/user/worker?action=load',
beforeSend: function(status, xhr) {
_$tb.empty().append('<tr><td colspan="8" style="text-align: center;">正在加载中...</td></tr>');
}
}).done(function(response, status, xhr) {
if (status == 'success' && response.status == 'ok') {
_f(response.data)
}
else {
_$tb.empty();
}
});
}
function _l(currency) {
$.ajax({
type: 'GET',
url: '/user/worker?action=load',
data: {currency: currency},
}).done(function(response, status, xhr) {
if (status == 'success' && response.status == 'ok') {
_f(response.data)
}
});
}
function _l_w($tr) {
var worker = $tr.data('worker');
$.ajax({
type: 'GET',
url: '/user/worker?action=get_user_worker',
data: {
worker_name: worker.worker_name
},
}).done(function(response, status, xhr) {
if (status == 'success' && response.status == 'ok') {
if (response.data.length == 1) {
worker = response.data[0];
$tr.replaceWith(_tr(worker));
}
}
});
}
$(function() {
_$t=$('#worker-list'); _$tb=_$t.find('tbody'); _$th=_$t.find('thead');
_$th.find(':checkbox').on('click', function() {
_$tb.find(':checkbox').prop('checked', $(this).prop('checked'));
});
_$t.on('click', '#action-change-currency', function() {
var $td = $(this).parent();
var worker = $td.parent().data('worker');
$td.html( '<ul class="cell-links">' +
' <li><select id="select-currency" style="width: 100px;"><option value="bitcoin">BTC</option><option value="litecoin">LTC</option></select></li>' +
' <li><a id="action-submit-update" href="javascript: void(0);"><i class="icon-ok-sign"></i></a></li>' +
' <li><a id="action-cancel-update" href="javascript: void(0);"><i class="icon-minus-sign"></i></a></li>' +
'</ul>'
);
$("#select-currency option").filter(function() {
return $(this).text() == worker.currency;
}).prop('selected', true);
});
_$t.on('change', '#select-operation', function() {
$('#select-operation > option:selected').each(function() {
var _v = $(this).val();
var $tr = $('#tr-operation');
if (_v == '1') {
$('#tr-operation').replaceWith(_tr_new());
} else if (_v == '2') {
$tr.replaceWith( '<tr id="tr-multi-update">' +
' <td colspan="8">' +
' <ul class="cell-links">' +
' <li><select id="select-currency" class="span4"><option value="bitcoin">BTC</option><option value="litecoin">LTC</option></select></li>' +
' <li><a id="action-submit-multi-update" href="javascript: void(0);"><i class="icon-ok-sign"></i></a></li>' +
' <li><a id="action-cancel-multi-update" href="javascript: void(0);"><i class="icon-minus-sign"></i></a></li>' +
' </ul>' +
' </td>' +
'</tr>');
} else if (_v == '3') {
$tr.replaceWith( '<tr id="tr-multi-delete">' +
' <td colspan="8">' +
' <ul class="cell-links">' +
' <li><a id="action-submit-multi-delete" href="javascript: void(0);"><i class="icon-ok-sign"></i></a></li>' +
' <li><a id="action-cancel-multi-delete" href="javascript: void(0);"><i class="icon-minus-sign"></i></a></li>' +
' </ul>' +
' </td>' +
'</tr>');
}
});
});
_$t.on('click', '#action-cancel-multi-update', function() {
$('#tr-multi-update').replaceWith(_tr_operation());
});
_$t.on('click', '#action-submit-multi-update', function() {
var worker_names = _$tb.find('input:checked').map(function(idx, value) {
return $(value).parent().parent().data('worker').worker_name;
});
$.ajax({
type: 'POST',
url: '/user/worker?action=change_workers_currency',
data: {
worker_names: worker_names.toArray(),
currency: $('#select-currency').val()
}
}).done(function(response, status, xhr) {
if (status == 'success' && response.status == 'ok') {
$('#actions > button.active').click();
}
});
});
_$t.on('click', '#action-cancel-multi-delete', function() {
$('#tr-multi-delete').replaceWith(_tr_operation());
});
_$t.on('click', '#action-submit-multi-delete', function() {
var worker_names = _$tb.find('input:checked').map(function(idx, value) {
return $(value).parent().parent().data('worker').worker_name;
});
$.ajax({
type: 'POST',
url: '/user/worker?action=delete_workers',
data: {
worker_names: worker_names.toArray(),
}
}).done(function(response, status, xhr) {
if (status == 'success' && response.status == 'ok') {
$('#actions > button.active').click();
}
});
})
_$t.on('click', '#action-cancel-insert', function() {
var $tr = $('#tr-insert');
$tr.replaceWith(_tr_operation());
});
_$t.on('click', '#action-submit-insert', function() {
$.ajax({
type: 'POST',
url: '/user/worker?action=insert_worker',
data: {
worker_name: $('#input-worker-name').val(),
currency: $('#select-currency').val()
}
}).done(function(response, status, xhr) {
if (status == 'success' && response.status == 'ok') {
$('#actions > button.active').click();
}
});
});
_$t.on('click', '#action-cancel-update', function() {
var $tr = $(this).parent().parent().parent();
$tr.html($tr.data('currency') + '<a id="action-change-currency" style="margin-left: 10px;" href="javascript: void(0);"><i class="icon-edit"></i></a>');
});
$('#worker-list').on('click', '#action-submit-update', function() {
var $tr = $(this).parent().parent().parent().parent();
$.ajax({
type: 'POST',
url: '/user/worker?action=change_worker_currency',
data: {
worker_name: $tr.data('worker').worker_name,
currency: $('#select-currency').val()
}
}).done(function(response, status, xhr) {
if (status == 'success' && response.status == 'ok') {
_l_w($tr);
}
});
});
$('#worker-list').on('click', '#action-delete', function() {
var $this = $(this);
var $tr = $this.parent().parent().parent().parent();
var $c = $('#worker-list > tbody');
var worker = $tr.data('worker');
$.ajax({
type: 'POST',
url: '/user/worker?action=delete_worker',
data: {worker_name: worker.worker_name}
}).done(function(response, status, xhr) {
if (status == 'success' && response.status == 'ok') {
$tr.remove();
}
});
});
$('#action-load-all').on('click', function(){
_l_all();
});

$('#action-load-btc').on('click', function(){
_l('BTC');
});

$('#action-load-ltc').on('click', function(){
_l('LTC');
});

_l_all();
})
//-->
</script>

</html>
被调试易程序运行完毕
回复

使用道具 举报

结帖率:79% (22/28)
 楼主| 发表于 2013-12-14 14:46:26 | 显示全部楼层   吉林省通化市
代码我传上来了,帮我看看。

鱼池.rar

111.18 KB, 下载次数: 3

回复

使用道具 举报

结帖率:100% (11/11)

签到天数: 16 天

发表于 2013-12-14 15:15:16 | 显示全部楼层   重庆市重庆市
建议楼主使用新版的精易模块,竟然还在使用,3.12的模块
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则 致发广告者

发布主题 收藏帖子 返回列表

sitemap| 易语言源码| 易语言教程| 易语言论坛| 易语言模块| 手机版| 广告投放| 精易论坛
拒绝任何人以任何形式在本论坛发表与中华人民共和国法律相抵触的言论,本站内容均为会员发表,并不代表精易立场!
论坛帖子内容仅用于技术交流学习和研究的目的,严禁用于非法目的,否则造成一切后果自负!如帖子内容侵害到你的权益,请联系我们!
防范网络诈骗,远离网络犯罪 违法和不良信息举报电话0663-3422125,QQ: 793400750,邮箱:wp@125.la
网站简介:精易论坛成立于2009年,是一个程序设计学习交流技术论坛,隶属于揭阳市揭东区精易科技有限公司所有。
Powered by Discuz! X3.4 揭阳市揭东区精易科技有限公司 ( 粤ICP备12094385号-1) 粤公网安备 44522102000125 增值电信业务经营许可证 粤B2-20192173

快速回复 返回顶部 返回列表