Forum in maintenance, we will back soon 🙂
Web Scraping using PHP
How to extract article content from various websites using PHP?
Did you try ChatGPT?
@pathumsam in my decades of IT work I used PHP extensively and can say that it is a wonderful language. However, now that I've began using Python I can say that it is so much easier to learn and use. So I would like to ask; why do you want to use PHP?
@admin Yeah, My current approach extracts content from headers (
<h2>, etc.) and paragraphs (
<p>). Still, I want to ensure that only the main article content is extracted, excluding any other non-essential text.
@ssadvisor Thank you for sharing your insights, and I completely agree with that. But I'm trying to create a WordPress tool with real-time data.
@pathumsam you can use Python within the WordPress site. Check out this article by @Hasan: https://learnwithhasan.com/create-ai-tools-with-wordpress/
@pathumsam each website has it is own structure, if you want to extract articles from any page, either you need to create your own script or use a ready-made package, I really don't know if there is something like that in PHP, but in python, we have newspaper package that I showed in the course