0

I am trying to test this feature "Get the plain text of John 3:16 from the LEB with JSONP " from here: http://api.biblia.com/docs/Samples

I want to fetch the JSONP data and use in my php script. I googled online, but did not find how to do it.

So I tried this way:

<?php
$jsonurl = "http://api.biblia.com/v1/bible/content/LEB.txt.js?passage=John3.16&key=fd37d8f28e95d3be8cb4fbc37e15e18e";
$json = file_get_contents($jsonurl);
$json_output = json_decode($json);
var_dump($json_output);

You can see actually i removed &callback=myCallbackFunction and use json instead of jsonp. I can get the result, but somehow I do not think this is the proper way to do it. So how could I do this in php properly?

user2294256
  • 1,029
  • 1
  • 13
  • 22
  • http://stackoverflow.com/questions/5081557/extract-jsonp-resultset-in-php –  May 17 '13 at 14:03
  • http://php.net/manual/en/function.json-decode.php –  May 17 '13 at 14:03
  • JSONP is a JavaScript expression. Getting JSON (which is a data format) and parsing it is a far better idea than getting a piece of JavaScript and trying to parse data out of it with PHP. – Quentin May 17 '13 at 14:04

0 Answers0