PHP的:解析器的ASP页面 [英] PHP : Parser asp page

查看:84
本文介绍了PHP的:解析器的ASP页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

早上好,我可以用php解析一个asp页面以获取html标记代码吗?

Googd morning, can I parser an asp page with php for to take the html tag code ?

如何从ASP页面获取此值<a href="xxx">**VALUE TO TAKE**</a>?

How can I take this value <a href="xxx">**VALUE TO TAKE**</a> from an asp page ?

推荐答案

是的,您可以使用 file_get_contents('http://www.example.com/myasp.asp'); 来获取字符串中的文件,然后使用一些RegEx来获取所需的数据.

Yes you can use file_get_contents('http://www.example.com/myasp.asp'); to get the file in a string and then use some RegEx to get the data you need.

类似

<?php
 /*GET ALL LINKS FROM http://www.w3schools.com/asp/default.asp*/
 $page = file_get_contents('http://www.w3schools.com/asp/default.asp');
preg_match_all("/<a.*>(.*?)<\/a>/", $page, $matches, PREG_SET_ORDER);
echo "All links : <br/>";
foreach($matches as $match){
    echo $match[1]."<br/>";
}
?>

这篇关于PHP的:解析器的ASP页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆