I am able to retrieve the results for a drug from the openFDA via PHP; however the results are just strings of text without formatting. Is there a version of the data that is formatted? Or is there a way to format it properly with line breaks, etc.? I feel the data is pointless if it isn't human readable.
How I am retrieving the data:
$xml_path = 'https://api.fda.gov/drug/label.json?api_key='.$api.'&search=set_id:'.$setid;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$xml_path);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
curl_close($ch);
$setid_array = json_decode($data, true);
// Empty string
$results = '';
// Ensure there is a setid array
if (!empty($setid_array)) {
// Results
$sections = $setid_array['results'][0];
// Cycle through each
foreach ($sections as $key => $section) {
// Get the content
$content = $section[0];
echo $content;
}
}
What I get for "Indications & Usage" on Rosuvastatin for example:
1 INDICATIONS AND USAGE Pediatric use information for patients 7 to 17 years of age is approved for AstraZeneca’s CRESTOR (rosuvastatin calcium) tablets. However, due to AstraZeneca’s marketing exclusivity rights, this drug product is not labeled with that pediatric information. Rosuvastatin tablets are an HMG Co-A reductase inhibitor indicated for: • adult patients with hypertriglyceridemia as an adjunct to diet ( 1.3 ) • adult patients with primary dysbetalipoproteinemia (Type III hyperlipoproteinemia) as an adjunct to diet ( 1.4 ) • adult patients with homozygous familial hypercholesterolemia (HoFH) to reduce LDL-C, total-C, and ApoB ( 1.5 ) Limitations of use (1.8): Rosuvastatin tablets have not been studied in Fredrickson Type I and V dyslipidemias. 1.3 Hypertriglyceridemia Rosuvastatin tablets are indicated as adjunctive therapy to diet for the treatment of adult patients with hypertriglyceridemia. 1.4 Primary Dysbetalipoproteinemia (Type III Hyperlipoproteinemia) Rosuvastatin tablets are indicated as an adjunct to diet for the treatment of adult patients with primary dysbetalipoproteinemia (Type III Hyperlipoproteinemia). 1.5 Adult Patients with Homozygous Familial Hypercholesterolemia Rosuvastatin tablets are indicated as adjunctive therapy to other lipid-lowering treatments (e.g., LDL apheresis) or alone if such treatments are unavailable to reduce LDL-C, Total-C, and ApoB in adult patients with homozygous familial hypercholesterolemia. 1.8 Limitations of Use Rosuvastatin tablets have not been studied in Fredrickson Type I and V dyslipidemias.