3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php /** Подключение **/ include('../config/config_global.php'); // тут лежат данные /** Ошибки **/ if(empty($_REQUEST['id'])){die("error_synt");} /** Функции **/ function str_count($str, $source) { $arr=explode($str,$source); return(count($arr)-1); } function call_film($url){ $json = file_get_contents($url); $json = json_decode($json, true); return $json; } function obrabotkatextmalbuk($str) { $str = strtolower($str); $search = array( 'Й','Ц','У','К','Е','Н','Г','Ш','Щ','З','Х','Ъ','Ф','Ы','В','А','П','Р','О','Л','Д','Ж','Э','Я','Ч','С','М','И','Т','Ь','Б','Ю','Ё'); $replace = array( 'й','ц','у','к','е','н','г','ш','щ','з','х','ъ','ф','ы','в','а','п','р','о','л','д','ж','э','я','ч','с','м','и','т','ь','б','ю','ё'); $str = str_replace($search, $replace, $str); return $str; } function obrabotkatextspecsimv($text) { $text = preg_replace ("/[^A-Za-zАаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя0-9\s]/" ,"" ,$text); return $text; } function obrabotkatextarr($text){ $text = preg_split("/[\s,]+/", $text); return $text; } function vk_enter($text){ $text = urlencode($text); $text = str_replace('%5Cr%5C','%0A',$text); $text = urldecode($text); return $text; } /** Основное **/ $id = urlencode($_REQUEST['id']); $id = call_film(_PATH_.'pars_kinopoisk/pars_prov_1.php?id='.$id); preg_match('#([0-9]{2,7})#',$id,$m); /** Постер **/ $pars_img = call_film(_PATH_.'pars_img/img.php?album_id='.$album_id.'&group_id='.$group_id.'&url=http://st.kp.yandex.net/images/film_big/'.$m[0].'.jpg'); $pars_img = $pars_img[0]; $pid = $pars_img['pid']; $owner_id = $pars_img['owner_id']; $photo = 'photo'.$owner_id.'_'.$pid; /** Инофрмация **/ $pars_kinopoisk = call_film(_PATH_.'pars_kinopoisk/film.php?id='.$m[0]); $name_film = $pars_kinopoisk['Name_film']; //имя фильма $desk_film = $pars_kinopoisk['Desk_film']; //описание фильма $short_desk_film = $pars_kinopoisk['Short_desk_film']; //крткое описание фильма $short_desk_film2 = $pars_kinopoisk['Short_desk_film2']; //крткое описание фильма2 $keyyear_film= array_search('год', $short_desk_film2); $year_film = obrabotkatextarr($short_desk_film[$keyyear_film]); //год $year_film = $year_film['1']; $keycountry_film = array_search('страна', $short_desk_film2); $country_film = obrabotkatextarr($short_desk_film[$keycountry_film]); //страна $country_film = $country_film['1']; $janrs = $pars_kinopoisk['janrs']; //жанр $janrs = obrabotkatextarr($janrs); //жанр $janrscount = count($janrs); if ($janrscount >1) array_pop($janrs); $janrs2 = $janrs; $janrs = implode(", ", $janrs); foreach ($janrs2 as &$text) { $text = mb_convert_case($text, MB_CASE_TITLE, "UTF-8"); $text = '#'.$text.'@film_ru'; } $janrs2 = implode(" ", $janrs2); $text = vk_enter($name_film.' ('.$year_film.') '.$country_film.'\r\ \r\Жанр: '.$janrs.'.\r\ \r\Описание: '.$desk_film.'\r\ \r\#'.$country_film.'@film_ru #Film@film_ru #'.$year_film.'_year@film_ru '.$janrs2); /** Видео **/ $strfxy = $_REQUEST['video']; $strfxy = str_replace(array("videos"), "lkfjg", $strfxy); $proverkavideoy = str_count('video', $strfxy); if ($proverkavideoy >= 1) { $videoy = explode('video', $strfxy, 2); $videoy = $videoy['1']; $video_ry = substr($videoy, 0, 19); $proverkazny = str_count('-', $video_ry); if ($proverkazny >= 1) $videoy = substr($video_ry, 0, 19); else $videoy = $video_ry; } if ($videoy <> null) $video_poly = "video".$videoy; $video = $video_poly; /** Vk_api **/ $v = new Vk($config); $constrik = $photo.','.$video; $response = $v->api('wall.post', array( 'message' => $text, 'attachments' => $constrik, 'owner_id' => $owner_id_con)); $my_token_stat = $v->api('account.getAppPermissions', array( )); $url = $v->get_code_token(); if ($my_token_stat['0']){echo('Token okay ');}else{ echo('Token not okay, reload you token <a href="'.$url.'">Reload token</a>');} //$get_token = $v->get_token('b193b74a02942ae15d'); /** Демонстрация: **/ $t = new lime_test(1); $id_post_vk = $response['post_id']; $error_post_vk = $response['error']; if ($error_post_vk) {$t->error('error',$line='92');} if ($id_post_vk) {$t->isa_ok($id_post_vk, 'integer', 'return id');} print_var($response); //echo $debug;
based on mc9SN
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
Warning: include(../config/config_global.php): failed to open stream: No such file or directory in /in/lFBji on line 3 Warning: include(): Failed opening '../config/config_global.php' for inclusion (include_path='.:') in /in/lFBji on line 3 error_synt
Output for hhvm-3.10.0 - 3.12.0
Warning: File not found: ../config/config_global.php in /in/lFBji on line 3 error_synt