Raex Posted August 22, 2014 Share Posted August 22, 2014 Hi, I'm trying to retrieve/scrape some information from a website using the class name and the tag name. Below is the example in VB: Dim htmL_cat As HTMLDocument Dim objTableL_cat As Object, objDatL_cat As Object, objItemL_cat As Object, objKeyL_cat As Object Dim intRowL_cat As Long Set htmL_cat = New HTMLDocument With CreateObject("MSXML2.XMLHTTP") .Open "GET", "http://www.lelong.com.my/Auc/List/BrowseAll.asp", False .send htmL_cat.body.innerHTML = .responseText End With With htmL_cat Set objTableL_cat = .getElementsByClassName("CatLevel1") 'Find elements with class name first For Each objDatL_cat In objTableL_cat Set objKeyL_cat = objDatL_cat.getElementsByTagName("a") 'Next, find elements with tag name For Each objItemL_cat In objKeyL_cat Sheets("Analytics").Range("E6").Offset(intRowL_cat, 0) = objItemL_cat.innerText intRowL_cat = intRowL_cat + 1 Next Next End With Set htmL_cat = Nothing Set objTableL_cat = Nothing Set objKeyL_cat = Nothing How do I do the same using PHP? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/290585-scraping-data-from-a-website-html-source-with-vb-example/ Share on other sites More sharing options...
Ch0cu3r Posted August 22, 2014 Share Posted August 22, 2014 By using simpleXML Quote Link to comment https://forums.phpfreaks.com/topic/290585-scraping-data-from-a-website-html-source-with-vb-example/#findComment-1488600 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.