Home  >  Article  >  Backend Development  >  php-Accessing Swift Code IFSC Codes API, Php Script Error

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

WBOY
WBOYOriginal
2016-06-02 11:34:151197browse

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.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn