高分求助!不够再加 可以调用对方的页面,查看对方页面的htm内容,用php把你需要的部分截取下来,在你的页面上显示。相当于网上的新闻小偷那样的作法。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 使用Socket发出post并接收,自行分析返回结果到页面 这样试试:提交到=>他的页面他的页面返回结果=>接收结果页面分析为你所用 Socket例子 2. Socket example: Simple TCP/IP clientThis example shows a simple, one-shot HTTP client. It simply connects to a page, submits a HEAD request, echoes the reply, and exits. <?phperror_reporting (E_ALL);echo "<h2>TCP/IP Connection</h2>\n";/* Get the port for the WWW service. */$service_port = getservbyname ('www', 'tcp');/* Get the IP address for the target host. */$address = gethostbyname ('www.example.com');/* Create a TCP/IP socket. */$socket = socket_create (AF_INET, SOCK_STREAM, 0);if ($socket < 0) { echo "socket_create() failed: reason: " . socket_strerror ($socket) . "\n";} else { echo "OK.\n";}echo "Attempting to connect to '$address' on port '$service_port'...";$result = socket_connect ($socket, $address, $service_port);if ($result < 0) { echo "socket_connect() failed.\nReason: ($result) " . socket_strerror($result) . "\n";} else { echo "OK.\n";}$in = "HEAD / HTTP/1.0\r\n\r\n";$out = '';echo "Sending HTTP HEAD request...";socket_write ($socket, $in, strlen ($in));echo "OK.\n";echo "Reading response:\n\n";while ($out = socket_read ($socket, 2048)) { echo $out;}echo "Closing socket...";socket_close ($socket);echo "OK.\n\n";?> 218.62.38.187/tian/index.php?id=600643我这是从yahoo里抓取动态股票行情的,你可以更换id变量,抓的是不同的股票信息你也可以使用这种原理,从网上一个专门提供工商名称的网站里抓取信息下面是代码<?php $data="http://cn.finance.yahoo.com/q?m=c&s=".$_GET["id"]."&d=v1"; $fp= @fopen($data,"r") or die("无法取得远程数据"); while(!feof($fp)){ $all.= @fgets($fp,1024); } @fclose($fp); $start=strpos($all,"<tr align=right>"); $end=strpos($all,"</table></td></tr><tr><td><small>"); $all=substr($all,$start,$end-$start); $all=str_replace("\r\n","",$all); $all=str_replace("\n","",$all); $all=str_replace(" nowrap align=left","",$all); $all=str_replace(" nowrap align=center","",$all); $all=str_replace(" nowrap","",$all); preg_match_all("|<td>(.*)</td>|U",$all,$info); for($i=1;$i<7;$i++){ $info[0][$i]=str_replace("<td>","",$info[0][$i]); $info[0][$i]=str_replace("</td>","",$info[0][$i]); echo $info[0][$i]."<br>";} ?> http://expert.csdn.net/Expert/topic/2213/2213914.xml?temp=.1852381 还是不行,我现在要访问的地址http://pol.royalmail.com/dda/AF.asp在postcode中输入Y021 3VB你就可以得到对应的地址,现在我用了上面的程序,还是没有返回,是不是我哪里搞错了,HELP ME:) 高分相增 在linux系统上无法实现php发送邮件 求php 续传思路 [求助]。xmlrpc网易博客报错,有源码 一个简单的php代码,为啥一开始用 <?php 结尾用 ?> 不对?结尾?>处有错误? php对mysql数据库操作,实现修改功能 mysql的select count如何才能更快点? 如果把查询到的结果插入另一张表呢?? 如果将PHP里面的日期格式转为JAVA里面对应的日期格式? 1000分都可以给你,LINUX+PHP+JAVA总是有问题 如何输出今天是一年的第几个星期,谢谢 关于双语系统 这样的错误怎么解决?php提示这样的warning!
提交到=>他的页面
他的页面返回结果=>接收结果页面
分析为你所用
例子 2. Socket example: Simple TCP/IP clientThis example shows a simple, one-shot HTTP client. It simply connects to a page, submits a HEAD request, echoes the reply, and exits. <?php
error_reporting (E_ALL);echo "<h2>TCP/IP Connection</h2>\n";/* Get the port for the WWW service. */
$service_port = getservbyname ('www', 'tcp');/* Get the IP address for the target host. */
$address = gethostbyname ('www.example.com');/* Create a TCP/IP socket. */
$socket = socket_create (AF_INET, SOCK_STREAM, 0);
if ($socket < 0) {
echo "socket_create() failed: reason: " . socket_strerror ($socket) . "\n";
} else {
echo "OK.\n";
}echo "Attempting to connect to '$address' on port '$service_port'...";
$result = socket_connect ($socket, $address, $service_port);
if ($result < 0) {
echo "socket_connect() failed.\nReason: ($result) " . socket_strerror($result) . "\n";
} else {
echo "OK.\n";
}$in = "HEAD / HTTP/1.0\r\n\r\n";
$out = '';echo "Sending HTTP HEAD request...";
socket_write ($socket, $in, strlen ($in));
echo "OK.\n";echo "Reading response:\n\n";
while ($out = socket_read ($socket, 2048)) {
echo $out;
}echo "Closing socket...";
socket_close ($socket);
echo "OK.\n\n";
?>
我这是从yahoo里抓取动态股票行情的,你可以更换id变量,抓的是不同的股票信息
你也可以使用这种原理,从网上一个专门提供工商名称的网站里抓取信息
下面是代码
<?php
$data="http://cn.finance.yahoo.com/q?m=c&s=".$_GET["id"]."&d=v1";
$fp= @fopen($data,"r") or die("无法取得远程数据");
while(!feof($fp)){
$all.= @fgets($fp,1024);
}
@fclose($fp);
$start=strpos($all,"<tr align=right>");
$end=strpos($all,"</table></td></tr><tr><td><small>");
$all=substr($all,$start,$end-$start);
$all=str_replace("\r\n","",$all);
$all=str_replace("\n","",$all);
$all=str_replace(" nowrap align=left","",$all);
$all=str_replace(" nowrap align=center","",$all);
$all=str_replace(" nowrap","",$all);
preg_match_all("|<td>(.*)</td>|U",$all,$info);
for($i=1;$i<7;$i++)
{
$info[0][$i]=str_replace("<td>","",$info[0][$i]);
$info[0][$i]=str_replace("</td>","",$info[0][$i]);
echo $info[0][$i]."<br>";
}
?>
在postcode中输入Y021 3VB你就可以得到对应的地址,
现在我用了上面的程序,还是没有返回,
是不是我哪里搞错了,HELP ME
:) 高分相增