note 123208 added to book.curl
| From: | under.yahoo.com via php-notes | Date: | Sun, 07 Oct 2018 14:17:50 +0000 |
| Subject: | note 123208 added to book.curl | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-209387@lists.php.net to get a copy of this message | ||
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/
----
Server IP: 208.43.231.9
Probable Submitter: 107.170.186.79
----
Manual Page -- http://php.net/manual/en/book.curl.php
Edit -- https://master.php.net/note/edit/123208
Del: integrated -- https://master.php.net/note/delete/123208/integrated
Del: useless -- https://master.php.net/note/delete/123208/useless
Del: bad code -- https://master.php.net/note/delete/123208/bad+code
Del: spam -- https://master.php.net/note/delete/123208/spam
Del: non-english -- https://master.php.net/note/delete/123208/non-english
Del: in docs -- https://master.php.net/note/delete/123208/in+docs
Del: other reasons-- https://master.php.net/note/delete/123208
Reject -- https://master.php.net/note/reject/123208
Search -- https://master.php.net/manage/user-notes.php