phpのcurlでjsonデータをgetで受け取って配列にするサンプル
phpのcurlでjsonデータをgetで受け取って配列にする
<?php
$url = "https://example.com";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$res = curl_exec($ch);
$json = json_decode($res, true);
curl_close($ch);
print_r($json);
<?php
$url = "https://example.com";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$res = curl_exec($ch);
$json = json_decode($res, true);
curl_close($ch);
print_r($json);
関連 2021-10-02 01:20:45