我不知道这是可能的还是允许的,但基本上我想去http://www.nfl.com/scores并获得特定星期的分数。似乎每个游戏都有一定的课程,如果我可以访问他们的html,我就可以轻松获得分数和团队。我想我需要使用AJAX或JSON或某种组合。谢谢!Javascript从外部网站获取html
UPDATE:
proxy.php
<html>
<head>
</head>
<body>
<?php
$url = "http://www.nfl.com/scores/2012/PRE1http://www.nfl.com/scores/2012/PRE1";
$htm = file_get_contents($url);
echo $htm;
?>
</body>
</html>
nflScores.php
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
</head>
<body>
<p></p>
<script type="text/javascript">
$.get("proxy.php", function(response) {
alert(response) });
</script>
</body>
</html>
看来,我的警告框充满吨的HTML。我可以使用某种.getElementByID()方法来查找某些元素吗?
感谢
可能重复[可以使用Javascript读取任何网页的源代码?](http://stackoverflow.com/questions/680562/can-javascript-read-the-source-of-any-web-page)和[Javascript或JQuery从外部网站获取html内容](可能是其他网站)(http://stackoverflow.com/questions/11788758/javascript-or-jquery-get-html-content-from-external-site)。 –