/** * yql -> tableau * @throws Exception * @param string $u * @return array|bool */ function inc_yql_to_array_dist($u) { define('_YQL_ENDPOINT', 'http://query.yahooapis.com/v1/public/yql?&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&q='); $v = recuperer_page($url = _YQL_ENDPOINT . urlencode($u) . '&format=json'); $w = json_decode($v); if (!$w) { throw new Exception('YQL: réponse vide ou mal formée'); return false; } return inc_object_to_array($w); }
/** * yql -> tableau * @throws Exception * @param string $u * @return array|bool */ function inc_yql_to_array_dist($u) { define('_YQL_ENDPOINT', 'http://query.yahooapis.com/v1/public/yql?&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&q='); $v = recuperer_url($url = _YQL_ENDPOINT . urlencode($u) . '&format=json'); if (!$v['page'] or !($w = json_decode($v['page'], true))) { throw new Exception('YQL: réponse vide ou mal formée'); } if (isset($w['error'])) { throw new Exception($w['error']['description']); } return inc_object_to_array($w); }