Does anyone know how to generate an excerpt from any page of an article (so it can be a source from many types of sites)? Something like facebook does when you paste the url into the message. Thanks.
What you want to do is called a web scraper . The main method for this would be to grab the page (you can clear the URL using file_get_contents ) and then somehow parse it for the content you want (i.e. pull the content from the <body> ).
file_get_contents
<body>
To parse the returned HTML, you must use the DOM parser. PHP has its own DOM classes that you can use.
Here is a video tutorial on how to do this:
http://net.tutsplus.com/tutorials/php/how-to-create-blog-excerpts-with-php/
Source: https://habr.com/ru/post/921689/More articles:urllib2 - ability to validate pass certificate - pythonScala actor inefficiency issue - javapython: How to determine when my thread becomes orphaned? - pythonPHP Scrape Article Excerpt as Readability - phpusing readability API to clear the most relevant page image - phpFragment compatibility onActivityResult () not working - androidCreate PDF using python - pythonSort table code in multiple .gs files - is it even possible? - google-apps-scriptCan a man-in-the-middle attack be prevented by using self-signed certificates? - sslMatte parallel processing using a network computer - parallel-processingAll Articles