note 127267 added to book.curl
| From: | Anonymous at main dot php dot net | Date: | Tue, 12 Jul 2022 03:40:00 +0000 |
| Subject: | note 127267 added to book.curl | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-218970@lists.php.net to get a copy of this message | ||
function curl_request($url, $method = 'get', $data = [], $type = 'https')
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if (strtolower($method == 'post')) {
$data = json_encode($data);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
}
if (strtolower($type) == 'https') {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
}
$result = curl_exec($ch);
if ($result == null || $result === false) {
print_r(curl_error($ch));
}
curl_close($ch);
return $result;
}
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.12.131 (proxied: 223.166.248.216)
----
Manual Page -- https://php.net/manual/en/book.curl.php
Edit -- https://main.php.net/note/edit/127267
Del: integrated -- https://main.php.net/note/delete/127267/integrated
Del: useless -- https://main.php.net/note/delete/127267/useless
Del: bad code -- https://main.php.net/note/delete/127267/bad+code
Del: spam -- https://main.php.net/note/delete/127267/spam
Del: non-english -- https://main.php.net/note/delete/127267/non-english
Del: in docs -- https://main.php.net/note/delete/127267/in+docs
Del: other reasons-- https://main.php.net/note/delete/127267
Reject -- https://main.php.net/note/reject/127267
Search -- https://main.php.net/manage/user-notes.php