Tag Archives: CURL

PHP CURL: Fetch Web Page Contents with Status Code

Basic implementation Copy-paste this function to get contents of a web served file / document from given URL. Note: CURL needs to be enabled on your system. function curl_get_contents( $url ) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); $http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); return array($http_status,$response); } Usage example $url […]

Continue reading

Creating HTML Links with Page Titles using Raw URLs in Linux Shell

Given a plain text list of URLs (for example links in your history) you want to create a list of HTML links which have the same title as the page’s document title. Offcourse, you want to do it with a script! Example input: https://www.invision-web.net/ https://www.share-2-web.com/ Example output: <a target=”_blank” href=”https://www.invision-web.net/”>InVision-Web.net :: Top work at Web […]

Continue reading