Skip to content

Tag: web-scraping

how to get multiple data from xpath query?

This is HTML page (test.html) The PHP Code here NOTE: i want to get result like this Answer One approach is to use the contextnode parameter to DOMXPath::query to do a subquery on each of the mainid elements for the child subids. Something like this: Note that the trim calls are necessary or you will end up w…

How to scrape SERP with PHP (for small project)

I thought this would be fairly simple but it’s proving challenging. Google uses https:// now and bing redirects to remove HTTP://. How can I grab the top 5 URLs for a given search term? I’ve tried several methods (including loading results into an iframe), but keep hitting brick walls with everyth…

PHP Scrape Article Excerpt like Readability

I’ve seen this question, but it doesn’t really satisfy what I’m looking for. That question’s answers were either: lift from the meta description tag, and the second was generating an excerpt for an article you already have the body from. What I want to do is actually get the first few …

Web scraping in PHP

I’m looking for a way to make a small preview of another page from a URL given by the user in PHP. I’d like to retrieve only the title of the page, an image (like the logo of the website) and a bit of text or a description if it’s available. Is there any simple way to do this without