function process_appgame_url($req_url) { preg_match('#^http://([a-zA-Z0-9\\-]+\\.)*appgame\\.com/([\\S]+/)?[\\d]+\\.html$#i', $req_url, $matches); if ($matches == null) { return false; } $res_obj = get_remote_json($req_url . '?json=1'); if ($res_obj === false) { return false; } $res = array(); $res['onebox'] = 'appgame-cms'; $res['provider_name'] = '任玩堂'; $res['provider_url'] = 'http://www.appgame.com/'; $res['favicon_url'] = 'http://www.appgame.com/favicon.ico'; $res['ori_url'] = $req_url; $res['title'] = $res_obj['post']['title']; $res['image'] = $res_obj['post']['thumbnail']; $res['ID'] = $res_obj['post']['id']; $res['update_time'] = format_time($res_obj['post']['modified']); $res['create_time'] = format_time($res_obj['post']['date']); $res['description'] = strip_tags(trim($res_obj['post']['excerpt'])); return $res; }
function get_remote_jsonex($url, $conn_timeout = 7, $timeout = 5) { if ($full_obj = get_remote_json($url . '?json=1', $conn_timeout, $timeout)) { $post =& $full_obj['post']; $content = $post['content']; if (($post_count = $post['page_count']) > 1) { for ($iter_count = 2; $iter_count <= $post_count; $iter_count++) { $new_url = $url . '/' . $iter_count; if ($json_obj = get_remote_json($new_url . '?json=1')) { $content .= $json_obj['post']['content']; } } } $post['content'] = $content; } return $full_obj; }