This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Display the array in a formatted manner | |
* Skip the struggle reading the array unformatted. | |
* Usage: rPrint($arrayElement); | |
*/ | |
function rPrint($arr) { | |
echo '<pre>'; | |
print_r($arr); | |
echo '</pre>'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'json' | |
#Rail API to be added here | |
url = 'You can find http API url from http://indianrailapi.com/IndianRail/API' | |
#Prepare and Execute the action | |
uri = URI(url) | |
response = Net::HTTP.get(uri) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const https = require('https'); | |
const URL = 'You can find http API url from https://indianrailapi.com/api-collection'; | |
https.get(URL, (resp) => { | |
let data = ''; | |
// A chunk of data has been recieved. | |
resp.on('data', (chunk) => { | |
data += chunk; | |
}); | |
// The whole response has been received. Print out the result. | |
resp.on('end', () => { |