array( 'method' => 'POST', 'content' => $data, ), )); //отправляем запрос $response = file_get_contents($config['10med_apiurl'], false, $context); file_put_contents('response.txt', var_export($response, true)); //var_dump($response); //die(); //разбираем ответ, перегоняем его в массив и возвращаем return unserialize($response); } class api10med{ private static $siteId = 11; private static $url = 'http://46.101.204.133/api/'; private static $tokenParam = '?access-token=5RJrtyWrOf7KlNc4Hzzj65NQ7Ud0AOKS'; public static function search($title) { $action = 'search'; $params = [ 'title' => $title, 'siteId' => self::$siteId, ]; $myCurl = curl_init(); curl_setopt_array($myCurl, array( CURLOPT_URL => self::$url . $action . self::$tokenParam, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => http_build_query($params) )); $res = curl_exec($myCurl); curl_close($myCurl); return $res; } public static function link($localId, $remoteId) { $action = 'link'; $params = [ 'siteId' => self::$siteId, 'id10med' => $remoteId, 'remoteProductId' => $localId, ]; $myCurl = curl_init(); curl_setopt_array($myCurl, array( CURLOPT_URL => self::$url . $action . self::$tokenParam, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => http_build_query($params) )); $res = curl_exec($myCurl); curl_close($myCurl); return $res; } public static function product($remoteId) { $action = 'product'; $params = [ 'siteId' => self::$siteId, 'id10med' => $remoteId, ]; $myCurl = curl_init(); curl_setopt_array($myCurl, array( CURLOPT_URL => self::$url . $action . self::$tokenParam, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => http_build_query($params) )); $res = curl_exec($myCurl); curl_close($myCurl); return $res; } } 1) { echo '
'; if (isset($_GET['c'])) $chpu = $_GET['c']; else { $chpu = $_POST['cat']; } $firstPage = getTemplateLink(Array('chpu' => $chpu), 'cat'); if ($qString == false) $qString = new queryString(); echo 'Показать все »'; if ($data['currentPage'] != 1) {// стрелка влево if ($data['currentPage'] - 1 >= 1) { echo 'prev'; } else { $firstPage = str_replace('?page=1', '', $firstPage); echo 'Показать все »'; } } echo ''; if ($data['currentPage'] != $data['pagesCount'])//стелка вправо echo 'next'; echo '
'; } }