note 127377 added to intro.curl
| From: | cll at example dot com | Date: | Mon, 01 Aug 2022 06:51:06 +0000 |
| Subject: | note 127377 added to intro.curl | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-219335@lists.php.net to get a copy of this message | ||
function geturl($url){
$headerArray
=array("Content-type:application/json;","Accept:application/json");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_HTTPHEADER,$headerArray);
$output = curl_exec($ch);
curl_close($ch);
$output = json_decode($output,true);
return $output;
}
function posturl($url,$data){
$data = json_encode($data);
$headerArray
=array("Content-type:application/json;charset='utf-8'","Accept:application/json");
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,FALSE);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl,CURLOPT_HTTPHEADER,$headerArray);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($curl);
curl_close($curl);
return json_decode($outputï¼true);
}
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.135 (proxied: 223.166.248.49)
----
Manual Page -- https://php.net/manual/en/intro.curl.php
Edit -- https://main.php.net/note/edit/127377
Del: integrated -- https://main.php.net/note/delete/127377/integrated
Del: useless -- https://main.php.net/note/delete/127377/useless
Del: bad code -- https://main.php.net/note/delete/127377/bad+code
Del: spam -- https://main.php.net/note/delete/127377/spam
Del: non-english -- https://main.php.net/note/delete/127377/non-english
Del: in docs -- https://main.php.net/note/delete/127377/in+docs
Del: other reasons-- https://main.php.net/note/delete/127377
Reject -- https://main.php.net/note/reject/127377
Search -- https://main.php.net/manage/user-notes.php