>  기사  >  백엔드 개발  >  php-Accessing Swift Code IFSC Codes API, Php Script Error

php-Accessing Swift Code IFSC Codes API, Php Script Error

WBOY
WBOY원래의
2016-06-02 11:34:151166검색

php

I am trying to access swift codes, ifsc codes, micr codes data from this free API, they have given this sample php code to access the data in JSON format.

unction get_ifsc_code($url, $curl = true) { $responseString = ''; if (!$curl) { /* * if !$curl, use 'file_get_contents' method * to get response string / $responseString = file_get_contents($url); } else { / * if $curl, use 'curl' method * to get response string */

<code>// Initializing curl$ch = curl_init( $url );// Configuring curl options$options = array(    CURLOPT_RETURNTRANSFER => true,    CURLOPT_HTTPHEADER => array('Content-type: application/json') ,    //Could be xml);// Setting curl optionscurl_setopt_array( $ch, $options );// Getting JSON encoded string$responseString =  curl_exec($ch);</code>

}
return $responseString;
}
Refer this github code
Sample code from the official site

Please help me in finding the error. I am not getting where it's going wrong.

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.