note 127502 added to book.curl
| From: | Anonymous at main dot php dot net | Date: | Wed, 17 Aug 2022 00:22:36 +0000 |
| Subject: | note 127502 added to book.curl | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-219441@lists.php.net to get a copy of this message | ||
public static function
request_url($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 ($type=='https'){
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
}
$res=curl_exec($ch);
if ($res==null||$res===false){
print_r($res);
}
curl_close($ch);
return json_decode($res,true);
}
----
Server IP: 45.112.84.4
Probable Submitter: 185.85.3.173 (proxied: 223.166.248.207)
----
Manual Page -- https://php.net/manual/en/book.curl.php
Edit -- https://main.php.net/note/edit/127502
Del: integrated -- https://main.php.net/note/delete/127502/integrated
Del: useless -- https://main.php.net/note/delete/127502/useless
Del: bad code -- https://main.php.net/note/delete/127502/bad+code
Del: spam -- https://main.php.net/note/delete/127502/spam
Del: non-english -- https://main.php.net/note/delete/127502/non-english
Del: in docs -- https://main.php.net/note/delete/127502/in+docs
Del: other reasons-- https://main.php.net/note/delete/127502
Reject -- https://main.php.net/note/reject/127502
Search -- https://main.php.net/manage/user-notes.php