diff --git a/curl.php b/curl.php new file mode 100644 index 0000000..f71f0d0 --- /dev/null +++ b/curl.php @@ -0,0 +1,33 @@ + 'king', + 'pwd' => '123456' +]; +$data = http_build_query($data); + +$ch = curl_init(); +curl_setopt($ch, CURLOPT_URL, $url); +curl_setopt($ch, CURLOPT_HEADER, false); +curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); +curl_setopt($ch, CURLOPT_HTTPHEADER, [ + 'Content-Type: application/json;charset=utf-8', +]); +curl_setopt($ch, CURLOPT_POST, true); +curl_setopt($ch, CURLOPT_POSTFIELDS, $data); +$result = curl_exec($ch); +if ($result === false) { + echo 'curlError: ' . curl_error($ch); +} else { + echo $result; +} +curl_close($ch); \ No newline at end of file