使用php抓一个网站(javascript网站) [英] Scrape a website (javascript website) using php

查看:83
本文介绍了使用php抓一个网站(javascript网站)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用简单的PHP脚本来抓取一个网站(相信它是在JavaScript中)。我是初学者,所以任何帮助将不胜感激。网页的网址为:

I am trying to scrape a website (believe it is in JavaScript) using a simple PHP script. I am a beginner so any help would be greatly appreciated. The URL of the webpage is:

http://www.indiainfoline.com/Markets/Company/Fundamentals/Balance-Sheet/Yes-Bank-Ltd/532648

所以这里例如我想在get_file_contents中传递公司名称(Yes-Bank-Ltd)和代码(532648)。不确定怎么做,所以有人可以帮忙。

So here for example I would like to pass the name of company (Yes-Bank-Ltd) and code (532648) in get_file_contents. Not sure on how to do it so can somebody please help.

谢谢,
Nidhi

Thanks, Nidhi

推荐答案

为什么不在网址中附加公司和代码的字符串。这里有一个想法,你填写一组公司和代码(需要相同的大小),然后你循环它们来刮取你想要的数据。

Why aren't you just not append the string of the company and code in the url. Here is an idea that you fill up an array of company and code (need to be the same size) and then you loop them to scrape the data you want.

for($i=0;$i<count($listOfCie);$i++)
{
    $cie = $listOfCie[$i];
    $code = $listOfCode[$i];
    $urlToScrape = "http://www.indiainfoline.com/Markets/Company/Fundamentals/Balance-Sheet/" . $cie . "/" . $code
    //... = get_file_contents($urlToScrape....
 }

这篇关于使用php抓一个网站(javascript网站)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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