网站建设资讯

NEWS

网站建设资讯

php怎么抓取隐藏数据 php怎么抓取隐藏数据的内容

PHP 如何隐藏数据库的IP后两位

$ip='192.168.2.13';

让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:空间域名、网络空间、营销软件、网站建设、龙华网站维护、网站推广。

$ip=substr($ip1,0,strrpos($ip1,'.')).'.*';

echo $ip;

我想用javascript把用PHP读到的某些数据行隐藏起来。比如学生表,我可以选择把所有性别为男的学生隐藏起来

首先你需要在php设计的时候就有这种想法。

?php

//这里是模拟你从数据库读出来的数据格式

$student['id'][0]="01";

$student['name'][0]="张三";

$student['sex'][0]="男";

$student['id'][1]='02';

$student['name'][1]="李四";

$student['sex'][1]="男";

$student['id'][2]='03';

$student['name'][2]="黄美美";

$student['sex'][2]="女";

?

!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""

html xmlns=""

head

meta http-equiv="Content-Type" content="text/html; charset=GB2312" /

titleUntitled Document/title

/head

script type="text/javascript"

function hideSex(type){

var objName;

var objName_;

var obj;

var obj_;

if(type==0){

objName="m";

objName_="f";

}else{

objName="f";

objName_="m";

}

obj=document.getElementsByName(objName);

obj_=document.getElementsByName(objName_);

vari=0;

for(i=0;iobj.length;i++){

obj[i].style.visibility="hidden";

}

for(i=0;iobj_.length;i++){

obj_[i].style.visibility="visible";

}

}

function showAll(){

var obj;

var obj_;

obj=document.getElementsByName("m");

obj_=document.getElementsByName("f");

for(i=0;iobj.length;i++){

obj[i].style.visibility="visible";

}

for(i=0;iobj_.length;i++){

obj_[i].style.visibility="visible";

}

}

/script

style type="text/css"

.div_id{top:0px;left:0px;width:20pxl;height:20px;line-height:20px;border:1px solid rgb(200,200,200);position:absolute}

.div_name{top:0px;left:20px;width:50px;height:20px;line-height:20px;border:1px solid rgb(200,200,200);position:absolute}

.div_sex{top:0px;left:70px;width:20px;height:20px;line-height:20px;border:1px solid rgb(200,200,200);position:absolute}

.bt{width:80px;height:20px;position:absolute}

/style

body

?php

for($i=0;$icount($student['id']);$i++){

$list_top=20*$i;

if($student['sex'][$i]=="男"){

$div_id="m";

}else{

$div_id="f";

}

echo "div name=\"".$div_id."\" style='top:".$list_top."px;left:0px;width:100px;height:20px;line-height:20px;border:0;position:absolute;'

div class='div_id align='center'".$student['id'][$i]."/div

div class='div_name' align='center'".$student['name'][$i]."/div

div class='div_sex' align='center'".$student['sex'][$i]."/div

/div";

}

echo("input type='submit' value='隐藏男生' onclick=\"hideSex(0);\" style='top:".($list_top+30)."px;left:0px;' class='bt'/");

echo("input type='submit' value='隐藏女生' onclick=\"hideSex(1);\" style='top:".($list_top+30)."px;left:90px;' class='bt'/");

echo("input type='submit' value='显示全部' onclick='showAll();' style='top:".($list_top+30)."px;left:180px;' class='bt'/");

?

/body

/html

这只是简单演示一下,至于什么重新排版什么的,你自己斟酌好了。

php用get表单传值,接入他站api后返回新数值,有没有办法隐藏或者修改伪装url?不用post

按我理解的你的意思,是访问你的博客的时候,参数里有个别的博客的网址,然后你的程序里通过这个网站把那个网站的内容抓 回来展示,如果是这样,有两种方式隐藏你说的url

把url参数加密或编码,服务器端取到后再解码(如:用base64_encode和base64_decode),简单的编码可以面对普通用户隐藏掉参数.

把你抓取的别的站的url在站内建一个数据库保存,然后,参数里用编码传,服务器根据编码把url取出来再展示。不过这种也可以直接把url的内容抓回来保存了,不用每次去抓

基于程序实现的代码逻辑研究上,这种方式可以尝试。但是不推荐商用的优化网站,直接把别人的内容拿来并且不署名。一是对作者的劳动果实不尊重,二是这种做法需要承担法律风险,如果传播程度广泛,原作者是可以通过法律途径获取赔偿的

php怎么抓取其它网站数据

可以用以下4个方法来抓取网站 的数据:

1. 用 file_get_contents 以 get 方式获取内容:

?

$url = '';

$html = file_get_contents($url);

echo $html;

2. 用fopen打开url,以get方式获取内容

?

$url = '';

$fp = fopen($url, 'r');

stream_get_meta_data($fp);

$result = '';

while(!feof($fp))

{

$result .= fgets($fp, 1024);

}

echo "url body: $result";

fclose($fp);

3. 用file_get_contents函数,以post方式获取url

?

$data = array(

'foo'='bar',

'baz'='boom',

'site'='',

'name'='nowa magic');

$data = http_build_query($data);

//$postdata = http_build_query($data);

$options = array(

'http' = array(

'method' = 'POST',

'header' = 'Content-type:application/x-www-form-urlencoded',

'content' = $data

//'timeout' = 60 * 60 // 超时时间(单位:s)

)

);

$url = "";

$context = stream_context_create($options);

$result = file_get_contents($url, false, $context);

echo $result;

4、使用curl库,使用curl库之前,可能需要查看一下php.ini是否已经打开了curl扩展

$url = '';

$ch = curl_init();

$timeout = 5;

curl_setopt ($ch, CURLOPT_URL, $url);

curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);

$file_contents = curl_exec($ch);

curl_close($ch);

echo $file_contents;


名称栏目:php怎么抓取隐藏数据 php怎么抓取隐藏数据的内容
URL链接:http://cdweb.net/article/dopsooh.html