如何使用php抓取基于javascript和ajax的网页数据

如何使用php抓取基于javascript和ajax的网页数据

问题描述:

I want to create a simple crawler using php for crawling a specific content of vodafone website.

I want to crawl the content from https://shop.vodafone.in/shop/rechargeOnline.jsp?cid=mum . In that,

View All Recharge->Bonus Card 5->Detals.

After clicking "Details" button, pop up window will appear. I want to extract whole data in the pop up window.

I'm able to extract static content. but the data in the pop up is depending of javascript and ajax call.

Somebody help me to get out of this problem.

PHP doesn't render JS, so you can't do what you are asking.

But, that page is making a request which you can directly read. It's making a request to: https://shop.vodafone.in/shop/ajax/viewRechargeDetails.jsp?id=sku4760065