철이
철이
php 에서 success페이지내 오류 문의
php에서 결재 연동중 success 페이지에서 "Call to undefined function: curl_setopt_array()" 이런 에러가 발생하고 있습니다. php5 이상에서 지원하는 함수 까지는 찾았는데 사용하는 php 버전이 4버전으로 위 함수를 사용할 수 없는데 다른 방법이 있을까요?<?php $paymentKey = $_GET['paymentKey']; $orderId = $_GET['orderId']; $amount = $_GET['amount']; $secretKey = 'test_ak_ZORzdMaqN3wQd5k6ygr5AkYXQGwy'; //$url = 'https://api.tosspayments.com/v1/payments/' . $paymentKey; $url = 'https://api.tosspayments.com/v1/payments/confirm'; $data = array('orderId' => $orderId, 'amount' => $amount); $credential = base64_encode($secretKey . ':'); $curlHandle = curl_init($url); curl_setopt_array($curlHandle, array( CURLOPT_POST => TRUE, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_HTTPHEADER => array( 'Authorization: Basic ' . $credential, 'Content-Type: application/json' ), CURLOPT_POSTFIELDS => json_encode($data) )); $response = curl_exec($curlHandle); $httpCode = curl_getinfo($curlHandle, CURLINFO_HTTP_CODE); $isSuccess = $httpCode == 200; $responseJson = json_decode($response); ?>
8 replies