curl $data = json_decode($response, true); null 값 질문 드립니다. 채택완료
cho개발
5년 전
조회 2,094
url_setopt($ch, CURLOPT_URL, $url.$queryParams); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); $response = curl_exec($ch); curl_close($ch); $data = json_decode($response, true); print_r($response);
일단 $resopnse까지는 값을 잘 불러오는데
json_decode 한뒤로 var_dump($data)를 하면 null값이 나옵니다..
댓글을 작성하려면 로그인이 필요합니다.
답변 2개
채택된 답변
+20 포인트
답변에 대한 댓글 4개
�
쟁반짜장
5년 전
�
쟁반짜장
5년 전
$datas = json_decode($response);
foreach($datas->response->body->items as $key => $value) {
echo $value->baseTime;
}
이렇게 해 보세요.
foreach($datas->response->body->items as $key => $value) {
echo $value->baseTime;
}
이렇게 해 보세요.
�
쟁반짜장
5년 전
dataType을 json으로 넘겨 보세요.
http://exam.dothome.co.kr/temp/wrid_359647.php
http://exam.dothome.co.kr/temp/wrid_359647.php
c
cho개발
5년 전
_type에서 dataType 요청변수 문제였네요.. 댓글감사합니다
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
사용 중이신 api url 알려주실 수 있나요?