コード例 #1
0
ファイル: file.class.php プロジェクト: tfont/skyfire
 protected function get_http_response_code($url)
 {
     if (defined('STRICT_TYPES') && CAMEL_CASE == '1') {
         return (int) self::parameters(['url' => DT::STRING])->call(__FUNCTION__)->with($url)->returning(DT::UINT8);
     } else {
         return (int) get_http_response_code($url);
     }
 }
コード例 #2
0
/**
 * Check & Load jQuery on CDN
 *
 */
function get_js_cdn($cdnLocation, $localLocation, $loadLocation)
{
    // Load jQuery from cdn if available
    if (get_http_response_code($cdnLocation) == 200) {
        drupal_add_js($cdnLocation, array('type' => 'file', 'scope' => $loadLocation, 'weight' => -25));
    } else {
        drupal_add_js(path_to_theme() . $localLocation, array('type' => 'file', 'scope' => $loadLocation, 'weight' => -25));
    }
}
コード例 #3
0
ファイル: fonts.php プロジェクト: rootcave/9livesprints-web
function openURL($url)
{
    if (get_http_response_code($url) != "200") {
        return false;
    }
    if (ini_get('allow_url_fopen')) {
        $data = file_get_contents($url);
    } else {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $data = curl_exec($ch);
        curl_close($ch);
    }
    return $data;
}
コード例 #4
0
function file_get_html($url, $use_include_path = false, $context = null, $offset = -1, $maxLen = -1, $lowercase = true, $forceTagsClosed = true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN = true, $defaultBRText = DEFAULT_BR_TEXT, $defaultSpanText = DEFAULT_SPAN_TEXT)
{
    // We DO force the tags to be terminated.
    $dom = new simple_html_dom(null, $lowercase, $forceTagsClosed, $target_charset, $stripRN, $defaultBRText, $defaultSpanText);
    // For sourceforge users: uncomment the next line and comment the retreive_url_contents line 2 lines down if it is not already done.
    if (get_http_response_code($url) != "404") {
        $contents = file_get_contents($url, $use_include_path, $context, $offset);
    } else {
        echo "error";
    }
    // Paperg - use our own mechanism for getting the contents as we want to control the timeout.
    //$contents = retrieve_url_contents($url);
    if (empty($contents) || strlen($contents) > MAX_FILE_SIZE) {
        return false;
    }
    // The second parameter can force the selectors to all be lowercase.
    $dom->load($contents, $lowercase, $stripRN);
    return $dom;
}
コード例 #5
0
function imdbFeedToArray($feed_url)
{
    global $list_title;
    $response_code = get_http_response_code($feed_url);
    if ($response_code != "200") {
        if ($response_code == "404") {
            die('Playlist not found.');
        }
        die('Error ' . $response_code);
    } else {
        $content = file_get_contents($feed_url);
    }
    $x = new SimpleXmlElement($content);
    $list_title = (string) $x->channel->title;
    $array = array();
    foreach ($x->channel->item as $entry) {
        $arr = array('pubDate' => (string) $entry->pubDate, 'title' => (string) $entry->title, 'link' => (string) $entry->link, 'imdbID' => (string) explode('/', $entry->link)[4]);
        array_push($array, $arr);
    }
    return $array;
}
コード例 #6
0
ファイル: stdf5.php プロジェクト: amage/fl-ru-damp
/**
 * Получает курсы валют с сайта ЦБ
 *
 * @return array массив, индексированный кодами валют (USD, EUR и т.д.), элементы которого есть свойства данной валюты.
 *               Курс рубля к каждой валюте берется из свойства 'Value'.
 */
function getCBRates()
{
    static $rates = NULL;
    if ($rates) {
        return $rates;
    }
    $memBuff = new memBuff();
    $curr_day = strtotime(date('d.m.Y'));
    if ($rdata = $memBuff->get('getCBRates')) {
        $rates = $rdata['rates'];
        if ($rdata['day'] == $curr_day) {
            return $rates;
        }
    }
    $xml = @file_get_contents('http://www.cbr.ru/scripts/XML_daily.asp', false, stream_context_create(array('http' => array('timeout' => 1))));
    //было 5 сек
    if ($xml && get_http_response_code($http_response_header) == 200) {
        $xmlDoc = new DOMDocument();
        if (@$xmlDoc->loadXML($xml)) {
            $rates = NULL;
            $xpath = new DOMXPath($xmlDoc);
            $valutes = $xpath->query('//Valute/CharCode');
            foreach ($valutes as $v) {
                $name = $v->nodeValue;
                if ($children = $v->parentNode->childNodes) {
                    foreach ($children as $ch) {
                        if ($ch->nodeType == XML_ELEMENT_NODE) {
                            $rates[$name][$ch->nodeName] = $ch->nodeValue;
                        }
                    }
                }
            }
            //@todo: кешируем курс пока на сутки потом нужно перерабоать в крон и БД
            $memBuff->set('getCBRates', array('day' => $curr_day, 'rates' => $rates), 86400);
        }
    }
    return $rates;
}
コード例 #7
0
function getStreams($channel_name)
{
    $token_content = json_decode(file_get_contents("http://api.twitch.tv/api/channels/" . $channel_name . "/access_token"));
    $token = $token_content->token;
    $sig = $token_content->sig;
    $random = rand(0, 10000000);
    $url_streams = "http://usher.twitch.tv/api/channel/hls/{$channel_name}.m3u8?player=twitchweb&token={$token}&sig={$sig}&\$allow_audio_only=true&allow_source=true&type=any&p={$random}";
    if (get_http_response_code($url_streams) != 200) {
        return false;
    } else {
        $streams = explode("\n", file_get_contents($url_streams));
        $streams_res = array();
        foreach ($streams as $key => $value) {
            if (stripos($value, "#EXT-X-STREAM-INF") !== false) {
                $info = explode(",", $value);
                $pl = explode("\"", $info[3]);
                $bw = explode("=", $info[1]);
                $res = explode("x", $info[2]);
                array_push($streams_res, array("name" => $pl[1], "res" => $res[1] . "p", "bw" => round($bw[1] / 1048576, 1), "stream" => $streams[$key + 1]));
            }
        }
        return $streams_res;
    }
}
コード例 #8
0
ファイル: sp.php プロジェクト: edinsof/Ecast
$app->get('/', function () use($app) {
    if ($_SESSION['group'] == 'adm') {
        $SPMenu = new SP\Menu\MenuInclusion();
        $SPMenu->MenuInclude($app);
        /*
         *      Update - Benachrichtigungen
         */
        $getConfigFromDB = DB::queryFirstRow("SELECT * FROM config WHERE id=%s", '1');
        if ($getConfigFromDB['upd_message'] == true) {
            function get_http_response_code($url)
            {
                $headers = get_headers($url);
                return substr($headers[0], 9, 3);
            }
            $URL = "http://login.streamerspanel.de/newversioncheck.php?rechNr=@RECHNR@&kdnr=@KDNUM@";
            if (get_http_response_code($URL) != "404") {
                $json = json_decode(file_get_contents($URL));
                if ($app->config('sp.version_clear') < $json->SP_Version) {
                    ?>
            <div class="container">
            <div class="row">
            <div class="span12">
            <div class="alert alert-info">
                <h4 class="alert-heading"><?php 
                    echo $json->Title;
                    ?>
</h4>
                <?php 
                    echo $json->Message;
                    ?>
            </div>
コード例 #9
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $authuser = Auth::user();
     $rules = array('titulo' => 'required', 'video' => 'required', 'contenido' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::to('administracion/videoblog/' . $id . '/edit')->with(array('usuarioimg' => $authuser->imagen, 'usuarionombre' => $authuser->nombre, 'usuarioid' => $authuser->id))->withErrors($validator)->withInput();
     } else {
         // store
         function get_http_response_code($theURL)
         {
             $headers = get_headers($theURL);
             return substr($headers[0], 9, 3);
         }
         $string = "http://www.youtube.com/oembed?url=http://www.youtube.com/watch?v=" . Input::get('video') . "&format=json";
         $code = get_http_response_code($string);
         if ($code != "200") {
             $errors = new MessageBag(['video' => ['Youtube ID does not correspond to a video']]);
             return Redirect::to('administracion/videoblog/' . $id . '/edit')->with(array('usuarioimg' => $authuser->imagen, 'usuarionombre' => $authuser->nombre, 'usuarioid' => $authuser->id))->withErrors($errors)->withInput();
         }
         $videoblog = VideoBlog::find($id);
         $videoblog->titulo = Input::get('titulo');
         $videoblog->video = Input::get('video');
         $videoblog->contenido = Input::get('contenido');
         $videoblog->save();
         $resString = 'Post de video blog editado exitosamente!';
         Session::flash('message', $resString);
         return Redirect::to('administracion/videoblog')->with(array('usuarioimg' => $authuser->imagen, 'usuarionombre' => $authuser->nombre, 'usuarioid' => $authuser->id));
     }
 }
コード例 #10
0
ファイル: DatabaseSeeder.php プロジェクト: stjanilofts/gicms
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        Model::unguard();
        function get_http_response_code($url)
        {
            $headers = get_headers($url);
            return substr($headers[0], 9, 3);
        }
        $url = 'http://girding.is';
        // Notendur
        \App\User::create(['name' => 'Netvistun', 'email' => '*****@*****.**', 'password' => bcrypt(env('NETVISTUN')), 'remember_token' => str_random(10)]);
        $json = file_get_contents('http://girding.is/_json_export/');
        $items = json_decode($json, true);
        $fyrirtaekid = factory(\App\Page::class)->create(['title' => 'Fyrirtækið', 'slug' => 'fyrirtaekid', 'content' => '
                    <p>Öryggisgirðingar ehf. bjóða fjölbreytt úrval af girðingarefni og hliðum, m.a. vörur frá hollensku fyrirtækjunum Hop fencing og Deciwand sem framleiða m.a. grindargirðingar oig hlið, franska fyrirtækinu DIRICKX sem býður allar tegundir af girðingum og hliðum, og danska fyrirtækinu KIBO-SYSTEM sem býður alhliða lausnir í hliðum og aðgangskerfum. Enska fyrirtækinu Zaun sem framleiðir grindur eftir málum eða hönnun, og bjóða svokallaðar hljóðlausar girðingar sem henta vel fyrir íþróttavelli. Öryggisgirðingar eru með umboð fyrir vörum frá alþjóða fyrirtækinu CAME sem framleiðir alhliða aðgangslausnir. Öryggisgirðingar ehf bjóða einnig uppá fjölbreytta járnsmíðavinnu.</p>

                    <h3>Öryggisgirðingar ehf</h3>
                    <ul>
                        <li>Kt. 450503-3390</li>
                        <li>Suðurhraun 2</li>
                        <li>210 Garðabær</li>
                        <li>Sími 544 4222</li>
                        <li>Fax 544 4221</li>
                        <li><a href="mailto:girding@girding.is">girding@girding.is</a></li>
                    </ul>
                ', 'images' => [], 'files' => []]);
        $unnid = factory(\App\Page::class)->create(['title' => 'Unnin verk', 'slug' => 'unnin-verk', 'content' => '', 'blade_view' => 'cards', 'images' => [], 'files' => []]);
        $json = file_get_contents('http://girding.is/_unnid_export/');
        $subbar = json_decode($json, true);
        foreach ($subbar as $item) {
            foreach ($item['images'] as $image) {
                $newPath = public_path() . '/uploads/' . $image['name'];
                $oldPath = $url . '/images/sent/' . $image['name'];
                if (!file_exists($newPath)) {
                    if (get_http_response_code($oldPath) == "200") {
                        $img = file_get_contents($url . '/images/sent/' . $image['name']);
                        file_put_contents(public_path() . '/uploads/' . $image['name'], $img);
                    }
                }
            }
            factory(\App\Page::class)->create(['title' => $item['title'], 'slug' => strtolower(str_slug($item['title'], '-')), 'status' => $item['publish'] ? 1 : 0, 'images' => $item['images'], 'parent_id' => $unnid->id]);
        }
        $item = false;
        $islensk = factory(\App\Page::class)->create(['title' => 'Íslensk framleiðsla', 'slug' => 'islensk-framleidsla', 'blade_view' => 'cards', 'content' => '
                    efni hér
                ', 'images' => [], 'files' => []]);
        $json = file_get_contents('http://girding.is/_islensk_export/');
        $subbar = json_decode($json, true);
        foreach ($subbar as $item) {
            foreach ($item['images'] as $image) {
                $newPath = public_path() . '/uploads/' . $image['name'];
                $oldPath = $url . '/images/sent/' . $image['name'];
                if (!file_exists($newPath)) {
                    if (get_http_response_code($oldPath) == "200") {
                        $img = file_get_contents($url . '/images/sent/' . $image['name']);
                        file_put_contents(public_path() . '/uploads/' . $image['name'], $img);
                    }
                }
            }
            factory(\App\Page::class)->create(['title' => $item['title'], 'slug' => strtolower(str_slug($item['title'], '-')), 'status' => $item['publish'] ? 1 : 0, 'images' => $item['images'], 'parent_id' => $islensk->id]);
        }
        $item = false;
        /*factory(\App\Page::class)->create([
              'title' => 'Fréttir',
              'slug' => 'frettir',
              'content' => '
                  efni hér
              ',
              'images' => [],
              'files' => [],
          ]);*/
        factory(\App\Page::class)->create(['title' => 'Vörur', 'slug' => 'vorur', 'content' => '
                ', 'images' => [], 'files' => []]);
        factory(\App\Page::class)->create(['title' => 'Hafa samband', 'slug' => 'hafa-samband', 'content' => '
                ', 'images' => [], 'files' => []]);
        factory(\App\Category::class)->create(['title' => 'Vörur', 'slug' => 'vorur', 'content' => '', 'images' => [], 'files' => []]);
        factory(\App\Category::class)->create(['title' => 'Produkter', 'slug' => 'produkter', 'content' => '', 'images' => [], 'files' => []]);
        foreach ($items as $item) {
            foreach ($item['images'] as $image) {
                $newPath = public_path() . '/uploads/' . $image['name'];
                $oldPath = $url . '/images/sent/' . $image['name'];
                if (!file_exists($newPath)) {
                    if (get_http_response_code($oldPath) == "200") {
                        $img = file_get_contents($url . '/images/sent/' . $image['name']);
                        file_put_contents(public_path() . '/uploads/' . $image['name'], $img);
                    }
                }
            }
            factory(\App\Category::class)->create(['id' => $item['id'], 'title' => $item['title'], 'slug' => strtolower(str_slug($item['title'], '-')), 'status' => $item['status'], 'content' => $item['content'], 'images' => $item['images'], 'files' => $item['files'], 'parent_id' => $item['parent_id']]);
            if (array_key_exists('products', $item) && !empty($item['products'])) {
                $skip = [];
                foreach ($item['products'] as $product) {
                    foreach ($product['images'] as $key => $image) {
                        $newPath = public_path() . '/uploads/' . $image['name'];
                        $oldPath = $url . '/images/sent/' . $image['name'];
                        if (!file_exists($newPath)) {
                            if (get_http_response_code($oldPath) == "200") {
                                $img = file_get_contents($oldPath);
                                file_put_contents($newPath, $img);
                            } else {
                                $skip[] = $key;
                            }
                        }
                    }
                    $_images = [];
                    foreach ($product['images'] as $k => $v) {
                        if (!in_array($k, $skip)) {
                            $_images[] = $v;
                        }
                    }
                    //print_r($_images);
                    foreach ($product['files'] as $file) {
                        $newPath = public_path() . '/files/' . $file['name'];
                        $oldPath = $url . '/files/' . $file['name'];
                        if (!file_exists($newPath)) {
                            if (get_http_response_code($oldPath) == "200") {
                                $_file = file_get_contents($oldPath);
                                file_put_contents($newPath, $_file);
                            }
                        }
                    }
                    factory(\App\Product::class)->create(['id' => $product['id'], 'title' => $product['title'], 'slug' => strtolower(str_slug($product['title'], '-')), 'status' => $product['status'], 'content' => $product['content'], 'images' => $_images, 'files' => $product['files'], 'category_id' => $product['category_id']]);
                }
            }
        }
        Model::reguard();
        $fyrirtaekid = getContentBySlug('fyrirtaekid');
        $fyrirtaekid->translations('no')->add('content', '
        <p>Tilbyr totalløsning på sikkerhetsgjerder, panelgjerder, selvbærende elektriske porter, overvåking og oppsetning.</p>
        <p>Firmaets mål er å tilby våre kunder total løsning på Deres behov for områdesikring. Vi skal levere ferdig oppsatte, driftsklare systemer som våre kunder er fornøyde med.</p>

        <h3>Sikkerhetsgjerder AS</h3>
        <ul>
            <li>Tomteråsveien 23</li>
            <li>2165 Hvam</li>
            <li>Tlf: 99 11 42 22</li>
            <li>post@sikkerhetsgjerder.no</li>
        </ul>');
        $fyrirtaekid->translations('no')->add('title', 'Firma');
        $fyrirtaekid->translations('is')->add('title', 'Fyrirtækið');
        $fyrirtaekid->translations('is')->add('slug', 'fyrirtaekid');
        $fyrirtaekid->translations('no')->add('slug', 'firma');
        $fyrirtaekid->translations('is')->add('content', '
        <p>Öryggisgirðingar ehf. bjóða fjölbreytt úrval af girðingarefni og hliðum, m.a. vörur frá hollensku fyrirtækjunum Hop fencing og Deciwand sem framleiða m.a. grindargirðingar oig hlið, franska fyrirtækinu DIRICKX sem býður allar tegundir af girðingum og hliðum, og danska fyrirtækinu KIBO-SYSTEM sem býður alhliða lausnir í hliðum og aðgangskerfum. Enska fyrirtækinu Zaun sem framleiðir grindur eftir málum eða hönnun, og bjóða svokallaðar hljóðlausar girðingar sem henta vel fyrir íþróttavelli. Öryggisgirðingar eru með umboð fyrir vörum frá alþjóða fyrirtækinu CAME sem framleiðir alhliða aðgangslausnir. Öryggisgirðingar ehf bjóða einnig uppá fjölbreytta járnsmíðavinnu.</p>

        <h3>Öryggisgirðingar ehf</h3>
        <ul>
            <li>Kt. 450503-3390</li>
            <li>Suðurhraun 2</li>
            <li>210 Garðabær</li>
            <li>Sími 544 4222</li>
            <li>Fax 544 4221</li>
            <li><a href="mailto:girding@girding.is">girding@girding.is</a></li>
        </ul>');
        $hafasamband = getContentBySlug('hafa-samband');
        $hafasamband->translations('no')->add('content', '');
        $hafasamband->translations('no')->add('title', 'Ta kontakt');
        $hafasamband->translations('is')->add('title', 'Hafa samband');
        $hafasamband->translations('no')->add('slug', 'ta-kontakt');
        $hafasamband->translations('is')->add('slug', 'hafa-samband');
        $hafasamband->translations('is')->add('content', '');
        $vorur = getContentBySlug('vorur');
        $vorur->translations('no')->add('content', '');
        $vorur->translations('no')->add('title', 'Produkter');
        $vorur->translations('is')->add('title', 'Vörur');
        $vorur->translations('no')->add('slug', 'produkter');
        $vorur->translations('is')->add('slug', 'vorur');
        $vorur->translations('is')->add('content', '');
    }
コード例 #11
0
function get_djias($date, $debug = false)
{
    $djia_e = false;
    $djia_w = false;
    $msg = "";
    if ($date >= "2008-05-27") {
        $dow_date_e = tweekDate($date, -1);
        // Use yesterday's opening price
        $dow_date_w = $date;
        // Use today's opening price
    } else {
        $dow_date_e = $date;
        // Use today's opening price
        $dow_date_w = $date;
        // Use today's opening price
    }
    if ($debug) {
        echo "<p>\$dow_date_e {$dow_date_e}<br>\$dow_date_w {$dow_date_w}</p>\n";
    }
    // -------------------------------------------------------------------------------------
    // Get data east of -30
    // -------------------------------------------------------------------------------------
    if (get_http_response_code("http://geo.crox.net/djia/{$dow_date_e}") != "200") {
        $msg .= "{$dow_date_e}: DJIA not found. Sorry!<br>";
    } else {
        $djia_e = file_get_contents("http://geo.crox.net/djia/{$dow_date_e}");
        if (!is_numeric($djia_e)) {
            $msg .= "DJIA \"{$djia_e}\" seems to be invalid - Sorry!<br>";
        }
    }
    // -------------------------------------------------------------------------------------
    // Get data west of -30
    // -------------------------------------------------------------------------------------
    if (get_http_response_code("http://geo.crox.net/djia/{$dow_date_w}") != "200") {
        $msg .= "{$dow_date_w}: DJIA not found. Sorry!<br>";
    } else {
        $djia_w = file_get_contents("http://geo.crox.net/djia/{$dow_date_w}");
        if (!is_numeric($djia_w)) {
            $msg .= "DJIA \"{$djia_w}\" seems to be invalid - Sorry!<br>";
        }
    }
    return array($djia_e, $djia_w, $msg);
}
 $dom->load($html);
 foreach ($dom->find('td[colspan=4]') as $row) {
     $ots = $row->plaintext;
     $ot = explode(",", $ots);
     foreach ($ot as $o) {
         $original = $o;
         $ot_words = array();
         $words = explode(" ", trim($o));
         foreach ($words as $w) {
             if (!strpos($w, ".")) {
                 $ot_words[] = trim($w);
             }
         }
         $o = implode(" ", $ot_words);
         $ot_trans = preg_replace($pattern, $replace, $o);
         if (get_http_response_code("http://graph.facebook.com/" . $ot_trans) != "404") {
             $json_fb = file_get_contents("http://graph.facebook.com/" . $ot_trans);
             $json = json_decode($json_fb);
             if ($json->first_name == true) {
                 $json = false;
             }
         } else {
             $json = false;
         }
         //print_r($json);
         if ($json) {
             $record = array("id" => $i, "name" => utf8_encode($o), "name_trans" => utf8_encode($ot_trans), "name_original" => utf8_encode($original), "fb_link" => $json->link, "website" => $json->website, "about" => $json->about, "likes" => $json->likes);
             scraperwiki::save(array('id'), $record);
         }
         $i++;
     }
コード例 #13
0
ファイル: avatar.tpl.php プロジェクト: spiritwild/biorhythm
<?php

$avatar_url = get_gravatar(load_member()['email']);
$header = get_http_response_code($avatar_url);
if ($header != '404') {
    ?>
<img id="avatar" src="<?php 
    echo $avatar_url;
    ?>
" alt="avatar" />
<?php 
}
コード例 #14
0
ファイル: DatabaseSeeder.php プロジェクト: stjanilofts/ofncms
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        Model::unguard();
        function get_http_response_code($url)
        {
            $headers = get_headers($url);
            return substr($headers[0], 9, 3);
        }
        // Notendur
        \App\User::create(['name' => 'Netvistun', 'email' => '*****@*****.**', 'password' => bcrypt(env('NETVISTUN')), 'remember_token' => str_random(10)]);
        $merki = factory(\App\Page::class)->create(['title' => 'Vörumerki', 'slug' => '_merki', 'content' => '', 'images' => [], 'files' => []]);
        factory(\App\Page::class)->create(['title' => 'Master Spas', 'slug' => '_master-spas', 'parent_id' => $merki->id, 'content' => '', 'images' => [['name' => 'logo-master-spas.png']], 'files' => []]);
        factory(\App\Page::class)->create(['title' => 'MHS Radiators', 'slug' => '_mhs', 'parent_id' => $merki->id, 'content' => '', 'images' => [['name' => 'logo-mhs.png']], 'files' => []]);
        factory(\App\Page::class)->create(['title' => 'Thor', 'slug' => '_thor', 'parent_id' => $merki->id, 'content' => '', 'images' => [['name' => 'logo-thor.png']], 'files' => []]);
        factory(\App\Page::class)->create(['title' => 'H2X', 'slug' => '_h2x', 'parent_id' => $merki->id, 'content' => '', 'images' => [['name' => 'logo-h2x.png']], 'files' => []]);
        factory(\App\Page::class)->create(['title' => 'Danfoss', 'slug' => '_danfoss', 'parent_id' => $merki->id, 'content' => '', 'images' => [['name' => 'logo-danfoss.png']], 'files' => []]);
        $stadsetning = factory(\App\Page::class)->create(['title' => 'Staðsetning', 'slug' => '_stadsetning', 'content' => '<iframe width="100%" height="100%" frameborder="0" src="http://ja.is/kort/embedded/?zoom=8&x=362806&y=405751&layer=map&q=Ofnasmi%C3%B0ja+Reykjav%C3%ADkur+ehf%2C+Vagnh%C3%B6f%C3%B0a+11"></iframe>', 'images' => [], 'files' => []]);
        $opnunartimi = factory(\App\Page::class)->create(['title' => 'Opnunartímar', 'slug' => '_opnunartimi', 'content' => '
<p><strong>Mán - Fim</strong><br />
09:00 - 17:00</p>

<p><strong>Fös</strong><br />
09:00 - 16:00</p>
                ', 'images' => [], 'files' => []]);
        $simi = factory(\App\Page::class)->create(['title' => 'Símanúmer', 'slug' => '_simi', 'content' => '<p><strong>Sími</strong><br>
(+354) 577 5177</p>

<p><strong>Fax</strong><br>
(+354) 577 5178</p>', 'images' => [], 'files' => []]);
        $forsidukubbar = factory(\App\Page::class)->create(['title' => 'Forsíðukubbar', 'slug' => '_forsidukubbar', 'content' => '', 'images' => [], 'files' => []]);
        factory(\App\Page::class)->create(['title' => 'Ofnar', 'slug' => '_kubbur-ofnar', 'url' => '#', 'parent_id' => $forsidukubbar->id, 'images' => [['name' => 'ofnar.jpg']]]);
        factory(\App\Page::class)->create(['title' => 'Handklæðaofnar', 'slug' => '_kubbur-handklaeda-ofnar', 'url' => '#', 'parent_id' => $forsidukubbar->id, 'images' => [['name' => 'handklaeda-ofnar.jpg']]]);
        factory(\App\Page::class)->create(['title' => 'Hitalausnir', 'slug' => '_kubbur-hitalausnir', 'url' => '#', 'parent_id' => $forsidukubbar->id, 'images' => [['name' => 'hitalausnir.jpg']]]);
        factory(\App\Page::class)->create(['title' => 'Ofnlokar og hitanemar', 'slug' => '_kubbur-ofnlokar-og-hitanemar', 'url' => '#', 'parent_id' => $forsidukubbar->id, 'images' => [['name' => 'ofnlokar-og-hitanemar.jpg']]]);
        factory(\App\Page::class)->create(['title' => 'Master Spas nuddpottar', 'slug' => '_kubbur-master-spas-nuddpottar', 'url' => '#', 'parent_id' => $forsidukubbar->id, 'images' => [['name' => 'master-spas.jpg']]]);
        factory(\App\Page::class)->create(['title' => 'Design ofnar', 'slug' => '_kubbur-design-ofnar', 'url' => '#', 'parent_id' => $forsidukubbar->id, 'images' => [['name' => 'design-ofnar.jpg']]]);
        factory(\App\Page::class)->create(['title' => 'Dustless blaster', 'slug' => '_kubbur-dustless-blaster', 'url' => '#', 'parent_id' => $forsidukubbar->id, 'images' => [['name' => 'dustless-blaster.jpg']]]);
        factory(\App\Page::class)->create(['title' => 'Önnur þjónusta', 'slug' => '_kubbur-onnur-thjonusta', 'url' => '#', 'parent_id' => $forsidukubbar->id, 'images' => [['name' => 'onnur-thjonusta.jpg']]]);
        $forsidumyndir = factory(\App\Page::class)->create(['title' => 'Forsíðumyndir', 'slug' => '_forsidumyndir', 'content' => '', 'images' => [], 'files' => []]);
        factory(\App\Page::class)->create(['title' => 'Vertu stjórnandi í þínu umhverfi í nuddpotti frá Master Spa', 'slug' => '_mynd1', 'parent_id' => $forsidumyndir->id, 'content' => '<p>Vertu stjórnandi í þínu umhverfi í nuddpotti frá Master Spa</p>', 'images' => [['name' => '5.jpg']], 'files' => []]);
        factory(\App\Page::class)->create(['title' => 'Vertu stjórnandi í þínu umhverfi í nuddpotti frá Master Spa', 'slug' => '_mynd2', 'parent_id' => $forsidumyndir->id, 'content' => '<p>Vertu stjórnandi í þínu umhverfi í nuddpotti frá Master Spa</p>', 'images' => [['name' => '6.jpg']], 'files' => []]);
        factory(\App\Page::class)->create(['title' => 'Vertu stjórnandi í þínu umhverfi í nuddpotti frá Master Spa', 'slug' => '_mynd3', 'parent_id' => $forsidumyndir->id, 'content' => '<p>Vertu stjórnandi í þínu umhverfi í nuddpotti frá Master Spa</p>', 'images' => [['name' => '4.jpg']], 'files' => []]);
        factory(\App\Page::class)->create(['title' => 'Sundtak snillings og fjölskylduskemmtun í H2X sundpotti', 'slug' => '_mynd5', 'parent_id' => $forsidumyndir->id, 'content' => '<p>Sundtak snillings og fjölskylduskemmtun í H2X sundpotti</p>', 'images' => [['name' => '3.jpg']], 'files' => []]);
        factory(\App\Page::class)->create(['title' => 'Ofnar í gæðaflokki', 'slug' => '_mynd6', 'parent_id' => $forsidumyndir->id, 'content' => '<p>Ofnar í gæðaflokki</p>', 'images' => [['name' => '1.jpg']], 'files' => []]);
        factory(\App\Page::class)->create(['title' => 'Ofnar í gæðaflokki', 'slug' => '_mynd7', 'parent_id' => $forsidumyndir->id, 'content' => '<p>Ofnar í gæðaflokki</p>', 'images' => [['name' => '2.jpg']], 'files' => []]);
        factory(\App\Page::class)->create(['title' => 'Handklæðaofnar í miklu úrvali', 'slug' => '_mynd8', 'parent_id' => $forsidumyndir->id, 'content' => '<p>Handklæðaofnar í miklu úrvali</p>', 'images' => [['name' => '7.jpg']], 'files' => []]);
        factory(\App\Page::class)->create(['title' => 'Handklæðaofnar í miklu úrvali', 'slug' => '_mynd9', 'parent_id' => $forsidumyndir->id, 'content' => '<p>Handklæðaofnar í miklu úrvali</p>', 'images' => [['name' => '8.jpg']], 'files' => []]);
        $fyrirtaekid = factory(\App\Page::class)->create(['title' => 'Fyrirtækið', 'slug' => 'fyrirtaekid', 'content' => '
<p>Ofnasmiðja Reykjavíkur er smásölufyrirtæki með starfsemi á Íslandi.</p>
<p>Hlutverk Ofnasmiðju Reykjavíkur er að bjóða viðskiptavinum góða vöru á hagstæðu verði og breytt úrval.  Um er að ræða miðstöðvarofna í öllum stærðum og gerðum, handklæðaofna, ofnloka, rafhitaða nuddpotta og fleira.</p>
<p>Ofnasmiðja Reykjavíkur var stofnað fyrst í kringum 1980 þá undir nafninu Ofnasmiðja Björns Oddssonar. Það var um haustið 1998 sem fyrirtækið flutti frá Egilsstöðum til Reykjavíkur og var þá nafnið Ofnasmiðja Reykjavíkur tekið upp og starfar undir því nafni í dag.</p>
<p>Fyrirtækið hefur flutt inn Thor ofnana frá Danmörku um árabil.  Árum áður var eingöngu um samsetningu að ræða og lökkun að ósk viðskiptavina.  Með tímanum var farið að framleiða helstu stærðir og allir ofnar skilaðir full lakkaðir með hvítu lakki.</p>
<p>Um 1990 - 1991 var farið að hefja innflutningi á tilbúnum ofnum, og enn í dag hefur þetta skilað sér  vel til viðskiptavina.  Allar helstu stærðir eru til á lager og viðskipatavinurinn getur fengið alla ofna afgreidda strax.</p>
                ', 'images' => [], 'files' => []]);
        factory(\App\Page::class)->create(['title' => 'Hafa samband', 'slug' => 'hafa-samband', 'content' => '', 'images' => [], 'files' => []]);
        factory(\App\Page::class)->create(['title' => 'Vörur', 'slug' => 'vorur', 'content' => '', 'images' => [], 'files' => []]);
        $url = 'http://ofnasmidja.is';
        /* import */
        $conn = new mysqli('157.157.17.4', 'ofnasmid_usr', 'QSxHwNQ3^rA#', 'ofnasmid_mambo3');
        $conn->set_charset("utf8");
        $result = $conn->query("SELECT * FROM mos_as_flokkar;");
        while ($row = $result->fetch_assoc()) {
            $slug = str_slug($row['title']);
            $newPath = public_path() . '/uploads/flokkur' . $row['id'] . '.jpg';
            $oldPath = $url . '/images/com_ahsshop/images/flokkur' . $row['id'] . '.jpg';
            $images = false;
            //if(!file_exists($newPath)) {
            if (get_http_response_code($oldPath) == "200") {
                $img = file_get_contents($oldPath);
                file_put_contents($newPath, $img);
                $images = [['name' => 'flokkur' . $row['id'] . '.jpg'], ['name' => 'a1.jpg'], ['name' => 'a2.jpg'], ['name' => 'a3.jpg'], ['name' => 'a4.jpg'], ['name' => 'a5.jpg'], ['name' => 'a6.jpg']];
            }
            //}
            $cat = false;
            $cat = factory(App\Category::class)->create(['id' => $row['id'], 'title' => $row['title'], 'slug' => $slug . '-' . $row['id'], 'status' => $row['active'] ? 1 : 0, 'order' => $row['ordering'], 'content' => $row['descr'], 'images' => $images]);
        }
        $result = $conn->query("SELECT * FROM mos_as_vorur;");
        while ($row = $result->fetch_assoc()) {
            $slug = str_slug($row['title']);
            $product = false;
            $files = false;
            $shell = false;
            $skirt = false;
            $tech = false;
            $sizes = false;
            if ($row['id'] == 108) {
                $files = [['title' => 'Kenwood-SIR-KEN1_Installation_Manual.pdf', 'name' => 'Kenwood-SIR-KEN1_Installation_Manual.pdf'], ['title' => 'Kenwood_European_Tuning_Conversions.pdf', 'name' => 'Kenwood_European_Tuning_Conversions.pdf']];
                $shell = [['title' => 'shell1.jpg', 'name' => 'shell1.jpg'], ['title' => 'shell2.jpg', 'name' => 'shell2.jpg'], ['title' => 'shell3.jpg', 'name' => 'shell3.jpg'], ['title' => 'shell4.jpg', 'name' => 'shell4.jpg'], ['title' => 'shell5.jpg', 'name' => 'shell5.jpg'], ['title' => 'shell1.jpg', 'name' => 'shell1.jpg'], ['title' => 'shell2.jpg', 'name' => 'shell2.jpg'], ['title' => 'shell3.jpg', 'name' => 'shell3.jpg'], ['title' => 'shell4.jpg', 'name' => 'shell4.jpg'], ['title' => 'shell5.jpg', 'name' => 'shell5.jpg'], ['title' => 'shell1.jpg', 'name' => 'shell1.jpg'], ['title' => 'shell2.jpg', 'name' => 'shell2.jpg'], ['title' => 'shell3.jpg', 'name' => 'shell3.jpg'], ['title' => 'shell4.jpg', 'name' => 'shell4.jpg'], ['title' => 'shell5.jpg', 'name' => 'shell5.jpg']];
                $skirt = [['title' => 'skirt1.jpg', 'name' => 'skirt1.jpg'], ['title' => 'skirt2.jpg', 'name' => 'skirt2.jpg'], ['title' => 'skirt3.jpg', 'name' => 'skirt3.jpg'], ['title' => 'skirt4.jpg', 'name' => 'skirt4.jpg'], ['title' => 'skirt5.jpg', 'name' => 'skirt5.jpg'], ['title' => 'skirt1.jpg', 'name' => 'skirt1.jpg'], ['title' => 'skirt2.jpg', 'name' => 'skirt2.jpg'], ['title' => 'skirt3.jpg', 'name' => 'skirt3.jpg'], ['title' => 'skirt4.jpg', 'name' => 'skirt4.jpg'], ['title' => 'skirt5.jpg', 'name' => 'skirt5.jpg'], ['title' => 'skirt1.jpg', 'name' => 'skirt1.jpg'], ['title' => 'skirt2.jpg', 'name' => 'skirt2.jpg'], ['title' => 'skirt3.jpg', 'name' => 'skirt3.jpg'], ['title' => 'skirt4.jpg', 'name' => 'skirt4.jpg'], ['title' => 'skirt5.jpg', 'name' => 'skirt5.jpg'], ['title' => 'skirt1.jpg', 'name' => 'skirt1.jpg'], ['title' => 'skirt2.jpg', 'name' => 'skirt2.jpg'], ['title' => 'skirt3.jpg', 'name' => 'skirt3.jpg'], ['title' => 'skirt4.jpg', 'name' => 'skirt4.jpg'], ['title' => 'skirt5.jpg', 'name' => 'skirt5.jpg']];
                $tech = "Hæð;1\nÞyngd;2\nLitur;3\nBreidd;4\nO.s.frv.;O.s.frv.";
                $sizes = "Stærð 1;80.000,- kr.\nEitthvað meira;1\nEitthvað meira;2\nEitthvað meira;3\n###\nStærð 2;82.000,- kr.\nEitthvað meira;1\nEitthvað meira;2\nEitthvað meira;3\n###\nStærð 3;84.000,- kr.\n###\nStærð 4;85.000,- kr.";
            }
            $newPath = public_path() . '/uploads/vara' . $row['id'] . '.jpg';
            $oldPath = $url . '/images/com_ahsshop/images/vara' . $row['id'] . '.jpg';
            $images = false;
            //if(!file_exists($newPath)) {
            if (get_http_response_code($oldPath) == "200") {
                $img = file_get_contents($oldPath);
                file_put_contents($newPath, $img);
                $images = [['name' => 'vara' . $row['id'] . '.jpg'], ['name' => 'a1.jpg'], ['name' => 'a2.jpg'], ['name' => 'a3.jpg'], ['name' => 'a4.jpg'], ['name' => 'a5.jpg'], ['name' => 'a6.jpg']];
            }
            //}
            $product = factory(App\Product::class)->create(['id' => $row['id'], 'title' => $row['title'], 'price' => $row['price'], 'category_id' => (int) $row['flokkur'], 'vnr' => $row['vnr'], 'slug' => $slug . '-' . $row['id'], 'status' => $row['published'] > 0 ? 1 : 0, 'order' => $row['ordering'], 'content' => $row['descr'], 'images' => $images, 'shell' => $shell ? $shell : [], 'tech' => $tech ? $tech : '', 'sizes' => $sizes ? $sizes : '', 'skirt' => $skirt ? $skirt : [], 'files' => $files ? $files : []]);
        }
        Model::reguard();
    }
コード例 #15
0
function videogall_get_thumbnail($url)
{
    global $videogall_url;
    $url = rtrim($url, '\\/');
    $thumb = $videogall_url . '/images/default.png';
    if (preg_match('/youtube.com\\/v/i', $url) > 0) {
        $pos1 = strpos($url, "v/");
        $pos1 = $pos1 + 2;
        $id = substr($url, $pos1, 11);
        $thumb = "http://img.youtube.com/vi/" . $id . "/0.jpg";
    } elseif (preg_match('/metacafe.com\\/fplayer/i', $url) > 0) {
        $url = str_replace("http://www.metacafe.com/fplayer/", "", $url);
        $substr = substr($url, 0, 7);
        $thumb = "http://www.metacafe.com/thumb/" . $substr . ".jpg";
    } elseif (preg_match('/dailymotion/i', $url) > 0) {
        $thumb = str_replace('embed/video', 'thumbnail/video', $url);
    } elseif (preg_match('/vimeo/i', $url) > 0) {
        $url = rtrim($url, "/");
        $pos1 = strrpos($url, "/");
        $id = substr_replace($url, '', 0, $pos1 + 1);
        if (get_http_response_code("http://vimeo.com/api/v2/video/" . $id . ".php")) {
            $hash = unserialize(file_get_contents("http://vimeo.com/api/v2/video/" . $id . ".php"));
            $thumb = $hash[0]['thumbnail_large'];
        } else {
            $thumb = $videogall_url . 'images/default.png';
        }
    } elseif (preg_match('/blip/i', $url) > 0) {
        if (get_http_response_code($url)) {
            preg_match('/<meta property="og:image"(.+)content="(.+)"\\/>/', file_get_contents($url), $matches);
            $thumb = $matches[2];
        } else {
            $thumb = $videogall_url . 'images/default.png';
        }
    } else {
        $thumb = $videogall_url . 'images/default.png';
    }
    return $thumb;
}
コード例 #16
0
ファイル: getData.php プロジェクト: rn222cx/1DV449
<?php

ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
error_reporting(-1);
$url = "http://api.sr.se/api/v2/traffic/messages?pagination=false&format=json";
$jsonData = "storage/SRdata.json";
if (intval(get_http_response_code($url)) == 200) {
    if (time() - filemtime($jsonData) > 300) {
        // Hämta ny data om nuvarande är 5 minuter gammal
        $rawJason = file_get_contents($url);
        file_put_contents($jsonData, $rawJason);
    }
}
$storedJason = file_get_contents($jsonData);
echo $storedJason;
/**
 * return the 3-digit HTTP response code
 *
 * @param $url
 * @return string
 */
function get_http_response_code($url)
{
    $headers = get_headers($url);
    return substr($headers[0], 9, 3);
}
コード例 #17
0
ファイル: etsis_Updater.php プロジェクト: parkerj/eduTrac-SIS
 /**
  * Checks the server for online status.
  *
  * @since 6.2.0
  * @return bool|`\app\src\Core\Exception\Exception`
  */
 public function getServerStatus()
 {
     $status = get_http_response_code($this->getReleaseJsonUrl());
     if ($status != 200) {
         return new \app\src\Core\Exception\Exception(_t('An unexpected error occurred. Something may be wrong with edutracsis.com or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://www.edutracsis.com/forums/forum/product-support/">support forums</a>.'), 'core_api_failed');
     }
     return true;
 }
コード例 #18
0
$json = json_encode($xml);
$array = json_decode($json, TRUE);
//Get only the user-agents string from array
$agents = $array['user-agent'];
// Create new array for our user-agents
$only_agents = array();
$count = 0;
// Add user agents to new array
foreach ($agents as $a) {
    $only_agents[$count] = $a['String'];
    $count++;
}
// Test each user agent by modifying php header
foreach ($only_agents as $val) {
    ini_set('user_agent', $val);
    $get_http_response_code = get_http_response_code($site);
    // Get the status code and set the varible $status
    if ($get_http_response_code == 200) {
        $status = "Success";
        $color = "green";
    } else {
        $status = "Failure";
        $color = "red";
    }
    echo "<tr><td class='" . $color . "'>" . $status . "</td><td>" . $val . "</td></tr>";
}
// Get the status code from header
function get_http_response_code($domain1)
{
    $headers = get_headers($domain1);
    return substr($headers[0], 9, 3);
コード例 #19
0
ファイル: PHPmvs.php プロジェクト: samedog/PHPmvs
function PHPapf_frame()
{
    global $action, $ap;
    html_header();
    echo "<body>\n\n\t\t<div align=left><h1>PHPapf</h1></div><br><br>\n\t\t<br>Thing is simple, just enter the url (http://www.example.com/) and WAIT.<br><br><br> \n\t\t<form action=\"" . $_SERVER['PHP_SELF'] . "?frame=11\" method=\"post\" name=\"ports\" id=\"ports\">\n\t\tURL: <input type=\"text\" name=\"url\" id=\"url\" size=\"65\" value=\"http://\"/>    <input type=\"submit\" name=\"ports\" id=\"ports\" value=\"scan\"/><br>\n\t\t</form> \n\t\t";
    if (isset($_POST['ports']) && $_POST['ports'] == 'scan') {
        $url = $_POST['url'];
        function get_http_response_code($theURL)
        {
            $headers = get_headers($theURL);
            $status = substr($headers[0], 9, 3);
            if ($status == 200 or $status == 403) {
                return "found <a href=\"{$theURL}\">{$theURL}</a> | status: {$status}<br>";
            } elseif ($status == 500) {
                return "<font color=\"red\">({$status})INTERNAL SERVER ERROR</font><a href=\"{$theURL}\">CHECK</a><br>";
            } elseif ($status != 500 and $status != 200 and $status != 403) {
                return "<font color=\"red\">ABNORMAL ERROR CODE OR SERVER STATUS FOUND <a href=\"{$theURL}\">{$theURL}</a></font><br>";
            }
        }
        foreach ($ap as $url2) {
            $url3 = $url . $url2;
            echo get_http_response_code($url3);
        }
    }
    echo "</body>\n</html>";
}
コード例 #20
0
ファイル: resolve.php プロジェクト: RokuHF/Quiplash-Resolver
$room = htmlspecialchars($room);
print "<title>Quiplash Resolver.</title>";
//Checks if entered code is valid.
if (strlen($room) < 4) {
    echo "Invalid room code. A room code must be 4 characters.";
    die;
}
if (strlen($room) > 4) {
    echo "Invalid room code. A room code must be 4 characters.";
    die;
}
if (!ctype_alpha($room)) {
    echo "Invalid room code. A room code only consists of alphabetical characters.";
    die;
}
// Checks if Jackbox API returns information, if so, grab it!
$json = "";
if (get_http_response_code('http://blobcast.jackboxgames.com/room/' . $room . '?userId=lolkekrt') != "200") {
    echo "An error occured. Is that the correct room code?";
    die;
} else {
    $json = file_get_contents('http://blobcast.jackboxgames.com/room/' . $room . '?userId=lolkekrt');
    // file_get_contents('http://somenotrealurl.com/notrealpage');
}
//Parses JSON API response.
$obj = json_decode($json);
$server = gethostbyname($obj->{'server'});
print "Server hostname: " . $obj->{'server'};
print "<br> Server IP: " . $server;
print "<br> Current audience count: " . $obj->{'numAudience'};
print "<br> <a href='./'>Go back<a/>.";
コード例 #21
0
ファイル: header.php プロジェクト: AveVlad/rghost
<?php

function get_http_response_code($URL)
{
    $headers = get_headers($URL);
    return substr($headers[0], 9, 3);
}
switch (get_http_response_code($URL)) {
    case 403:
        $XMLText = file_get_contents("http://rghost.net/download/metafile/" . $_POST["id"] . "/1");
        preg_match('/<title>(.*)<\\/title>/s', $XMLText, $res);
        preg_match_all("<a href=\"(.+?)\">", $XMLText, $matches);
        // save all links \x22 = "
        // delete redundant parts
        $matches = str_replace("a href=", "", $matches);
        // remove a href=
        $matches = str_replace("\"", "", $matches);
        // remove "
        // output all matches
        $download_link = $matches[1][4];
        $name = $res[1];
        echo $name;
        echo '<br>';
        $_POST['text'] = file_get_contents($download_link);
        echo '<a href="' . $download_link . '">download</a>';
        echo ' | ';
        break;
    case 404:
        echo " 404 not found :( ";
        break;
    case 200:
コード例 #22
0
}
$console = Console::getInstance();
if (!isset($argv[1])) {
    $console->writeLine("Sitemap url not set", Color::RED);
    die;
}
$sitemapUrl = $argv[1];
proccessSiteMapUrl($sitemapUrl);
$countUrls = count($urls);
$console->writeLine("Url count: " . $countUrls);
$i = 0;
foreach ($urls as $url) {
    $i++;
    echo "On " . $i . " of " . $countUrls . ($i === $countUrls ? "\n" : "\r");
    usleep(1000);
    $code = get_http_response_code($url['loc']);
    if (!isset($responseCodes[$code])) {
        $responseCodes[$code] = 0;
    }
    $responseCodes[$code]++;
    $url['code'] = $code;
}
ksort($responseCodes);
foreach ($responseCodes as $code => $count) {
    $console->writeLine("Code " . $code . " : " . $count);
}
if (count($responseCodes) === 1 && isset($responseCodes[200])) {
    $console->writeLine("Success", Color::GREEN);
} else {
    $console->writeLine("Errors found", Color::RED);
}