Skip to content

Instantly share code, notes, and snippets.

@Fedcomp
Fedcomp / get_web_page.php
Last active April 8, 2019 01:33
Example remote page download with php-curl.
<?php
function get_web_page( $url ){
$options = array(
CURLOPT_RETURNTRANSFER => true, // return web page
CURLOPT_HEADER => false, // don't return headers
CURLOPT_FOLLOWLOCATION => true, // follow redirects
CURLOPT_ENCODING => "", // handle all encodings
CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17", // who am i
CURLOPT_AUTOREFERER => true, // set referer on redirect