Hi, i'm using YQL to send data back to an iPhone app i'm developing. I've got a JSON parser on the iphone and a PHP page on my webhost.
This is the PHP:
<?php
header('Content-type: application/json');
$arr = array();
$result = $_GET["q"];
$yql_base_url = "http://query.yahooapis.com/v1/public/yql";
$yql_query = "select * from search.web where query ='%s'"; //YQL query to retrieve search results
$value = "lindsay+lohan";
$yql_query_url = $yql_base_url . "?q=" . urlencode(sprintf($yql_query, $value)) . "&format=json";
$session = curl_init($yql_query_url);
$json = curl_exec($session);
curl_close($session);
$temp = json_decode($json);
$arr[] = $temp;
echo json_encode($arr);
?>
When i use my iphone app and attempt to retrieve it, it says "Json parse failed: Garbage after JSON"
And if i run the PHP file in a browser, i see all the JSON data fine but after it there is "[1]", which is screwing it up i think?
Any ideas?