note 123208 deleted from book.curl by cmb

From: Date: Sun, 07 Oct 2018 14:34:14 +0000
Subject: note 123208 deleted from book.curl by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-209388@lists.php.net to get a copy of this message
Note Submitter: under at yahoo dot com ---- Here you have a function that I use to get the content of a URL using cURL: function getUrlContent($url){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($ch, CURLOPT_TIMEOUT, 5); $data = curl_exec($ch); $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); return ($httpcode>=200 && $httpcode<300) ? $data : false; } The source comes from this website: https://bestelectricbikeunder.com/

« previous php.notes (#209388) next »