I am trying to get access toke from FB through Developer App. But I am not able to json_decode the call back response. If I use the token_url call from browser, it returns the access token. But from within the script it does work. I searched online and foun that it could be that the Json encoded response must be containg some UTF -8 BOM. So I tried some functions that would strip the response from that. However, I still am not able to get that elusive access token as a variable by json decoding and getting an array. My …

Member Avatar
+0 forum 0

I'm using `file_get_contents()` to parse data of a JSON file within a `foreach()` loop onto my page. <?php $url = 'data/gigs.json'; $data = file_get_contents($url); $gigs = json_decode($data, true); foreach ($gigs as $gig) { echo '<tr>'; echo '<td><time>' . $gig['date'] . '</time></td>'; echo '<td>' . $gig['event_venue'] . '</td>'; echo '<td>' . $gig['location'] . '</td>'; echo '<td><a class="btn btn-primary external" href="' . $gig['tickets_url'] . '">Buy</a></td>'; echo '</tr>'; } ?> This works fine and I also want to parse this data onto the homepage, but this time I only want to parse let's say the first 5 records of the JSON array. I …

Member Avatar
Member Avatar
+0 forum 1

HI guys, I seem to be having an issue declaring a json string. The original string I have is this: var jsonString = '{ "details" : [' + '{"text":"Lorem ipsum dolor sit amet, consectetur 0", "firstName":"Jack0", "surname":"Dee0", "moreInfo":"This is extra information"},' + '{"text":"Lorem ipsum dolor sit amet, consectetur 1", "firstName":"Jack1", "surname":"Dee1", "moreInfo":"This is extra information"},' + ']}'; and if I parse it jsonStringParsed = JSON.parse(jsonString); console.log(jsonStringParsed); I get what I expected in the console, two objects: details:Array[2] 0:Object firstName:"Jack0" moreInfo:"This is extra information" surname:"Dee0" text:"Lorem ipsum dolor sit amet, consectetur 0" 1:Object firstName:"Jack1" moreInfo:"This is extra information" surname:"Dee1" text:"Lorem ipsum …

Member Avatar
Member Avatar
+0 forum 10

The End.