I am trying to get the indications_and_usage part in the results section from the following JSON URL: https://api.fda.gov/drug/label.json?search=levodopa
Till now, I have
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
//curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyauth);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
$data = curl_exec($ch);
curl_close($ch);
in my php file. When I echo $data, it gives the entire json as output. How can I modify this to get the indications_and_usage part?
As none of the methods seem to be working, here is the beginning output when I do
echo $data;
HTTP/1.1 200 Connection established HTTP/1.1 200 OK Access-Control-Allow-Headers: X-Requested-With Access-Control-Allow-Origin: * Age: 0 Cache-Control: public, max-age=60 Content-Security-Policy: default-src 'none' Content-Type: application/json; charset=utf-8 Date: Sun, 21 Feb 2016 19:49:27 GMT ETag: W/"19923-bQuoDHROKCsX/qDsyE4GuA" Server: openresty Vary: Accept-Encoding Vary: Accept-Encoding Vary: Accept-Encoding Via: http/1.1 api-umbrella (ApacheTrafficServer [cSsSfU]) X-Cache: MISS X-Content-Type-Options: nosniff X-Frame-Options: deny X-XSS-Protection: 1; mode=block Content-Length: 104739 Connection: keep-alive { "meta": { "disclaimer": "openFDA is a beta research project and not for clinical use. While we make every effort to ensure that data is accurate, you should assume all results are unvalidated.", "license": "http://open.fda.gov/license", "last_updated": "2016-02-05", "results": { "skip": 0, "limit": 1, "total": 1400 } }, "results": [ { "effective_time": "20120305", "drug_interactions": [ "DRUG INTERACTIONS Few systemic data have been collected on the metabolism of bupropion following concomitant administration with other drugs or, alternatively, the effect of concomitant administration of bupropion on the metabolism of other drugs. ..... and so on