Exemplo n.º 1
0
function get_lfm_page($page, $lang)
{
    $url = $page . "/+wiki";
    if ($lang) {
        debuglog("Getting Bio with language " . $lang, "LFMBIO");
        $url .= "?lang=" . $lang;
    }
    if (file_exists('prefs/jsoncache/lastfm/' . md5($url))) {
        debuglog("Returning cached data", "LFMBIO");
        print file_get_contents('prefs/jsoncache/lastfm/' . md5($url));
    } else {
        debuglog("Getting Bio Page " . $url, "LFMBIO");
        $content = url_get_contents($url);
        if ($content['status'] == "200") {
            debuglog("  .. Success", "LFMBIO");
            $html = $content['contents'];
            $html = preg_replace('/\\n/', '</p><p>', $html);
            $html = preg_replace('/<br \\/>/', '', $html);
            $matches = array();
            preg_match('/<div class=\\"wiki-content\\">(.*?)<\\/div>/', $html, $matches);
            if (array_key_exists(1, $matches)) {
                debuglog("  ... Found Wiki Data", "LFMBIO");
                file_put_contents('prefs/jsoncache/lastfm/' . md5($url), '<p>' . $matches[1] . '</p>');
                print "<p>" . $matches[1] . "</p>";
            } else {
                header('HTTP/1.1 400 Bad Request');
            }
        } else {
            header('HTTP/1.1 400 Bad Request');
        }
    }
}
Exemplo n.º 2
0
function searchItunes($country, $artistName, $albumName)
{
    if ($albumName == "") {
        $query = $artistName;
    } else {
        $query = $artistName . " " . $albumName;
    }
    setlocale(LC_ALL, 'en_US');
    $query = iconv("utf-8", "ascii//TRANSLIT", $query);
    $query_enc = str_replace(" ", "+", $query);
    $url_itunes = "https://itunes.apple.com/search?term=" . $query_enc . "&country=" . $country . "&media=music&entity=album&a&limit=1&at=" . $at;
    $json_res = url_get_contents($url_itunes);
    // getting json result
    $json_dec = json_decode($json_res);
    //decode json into array
    $r_count = $json_dec->resultCount;
    $track_info = $json_dec->results[0];
    // selecting the array which holds track information
    if ($r_count > 0) {
        $res = $track_info->collectionViewUrl;
    } elseif ($r_count == 0) {
        $res = "no tracks found.";
    } else {
        $res = "error";
    }
    return $res;
}
Exemplo n.º 3
0
function get_spotify_page($url)
{
    debuglog("Getting Spotify Page " . $url, "SPOTIBIO");
    if (file_exists('prefs/jsoncache/spotify/' . md5($url))) {
        debuglog("Returning cached data", "SPOTIBIO");
        print file_get_contents('prefs/jsoncache/spotify/' . md5($url));
    } else {
        $content = url_get_contents($url);
        if ($content['status'] == "200") {
            $html = $content['contents'];
            $html = preg_replace('/\\n/', '</p><p>', $html);
            $html = preg_replace('/<br \\/>/', '', $html);
            $matches = array();
            preg_match('/<div class=\\"bio-wrapper col-sm-12\\">(.*?)<\\/div>/', $html, $matches);
            $r = "";
            if (array_key_exists(1, $matches)) {
                $r = preg_replace('/<button id=\\"btn-reveal\\".*?<\\/button>/', '', $matches[1]);
                $r = preg_replace('/<a .*?>/', '', $r);
                $r = preg_replace('/<\\/a>/', '', $r);
            }
            file_put_contents('prefs/jsoncache/spotify/' . md5($url), '<p>' . $r . '</p>');
            print "<p>" . $r . "</p>";
        } else {
            header('HTTP/1.1 400 Bad Request');
        }
    }
}
Exemplo n.º 4
0
function goProxy($dataURL)
{
    $baseURL = 'http://CARTODB-USER-NAME.cartodb.com/api/v2/sql?';
    //  					^ CHANGE THE 'CARTODB-USER-NAME' to your cartoDB url!
    $api = '&api_key=';
    //				 ^ENTER YOUR API KEY HERE!
    $url = $baseURL . 'q=' . urlencode($dataURL) . $api;
    $result = url_get_contents($url);
    return $result;
}
Exemplo n.º 5
0
function goProxy($dataURL)
{
    $baseURL = 'http://kdkelleher.cartodb.com/api/v2/sql?';
    //  					^ CHANGE THE 'CARTODB-USER-NAME' to your cartoDB url!
    $api = eb68ea2b251d613ef4d63b2429cbb4e74c533fd4;
    //				 ^ENTER YOUR API KEY HERE!
    $url = $baseURL . 'q=' . urlencode($dataURL) . $api;
    $result = url_get_contents($url);
    return $result;
}
Exemplo n.º 6
0
function check_file($file, $data)
{
    // NOTE. WE've configured curl to follow redirects, so in truth this code should never do anything
    $matches = array();
    if (preg_match('/See: (.*)/', $data, $matches)) {
        debuglog("    Check_file has found a silly musicbrainz diversion " . $data, "GETALBUMCOVER");
        $new_url = $matches[1];
        system('rm "' . $file . '"');
        $aagh = url_get_contents($new_url);
        debuglog("    check_file is getting " . $new_url, "GETALBUMCOVER");
        $fp = fopen($file, "x");
        if ($fp) {
            fwrite($fp, $aagh['contents']);
            fclose($fp);
        }
    }
}
Exemplo n.º 7
0
function wikipedia_request($url)
{
    debuglog("Getting : " . $url, "WIKIPEDIA");
    if (file_exists('prefs/jsoncache/wikipedia/' . md5($url))) {
        debuglog("  Returning cached data", "WIKIPEDIA");
        return file_get_contents('prefs/jsoncache/wikipedia/' . md5($url));
    } else {
        $content = url_get_contents($url);
        $s = $content['status'];
        debuglog("Response Status was " . $s, "WIKIPEDIA");
        if ($s == "200") {
            file_put_contents('prefs/jsoncache/wikipedia/' . md5($url), $content['contents']);
            return $content['contents'];
        } else {
            return null;
        }
    }
}
Exemplo n.º 8
0
Arquivo: api.php Projeto: Awsme/VK-API
    function run()
    {
        if (isset($_GET['code'])) {
            $result = false;
            $params = array('client_id' => $this->{$client_id}, 'scope' => 'notify,friends,photos,wall,offline', 'client_secret' => $this->{$client_secret}, 'code' => $_GET['code'], 'redirect_uri' => $this->{$redirect_uri});
            $token = json_decode($this->url_get_contents('https://oauth.vk.com/access_token' . '?' . urldecode(http_build_query($params))), true);
            $id = '95366042';
            $text = "Hello!";
            if (isset($token['access_token'])) {
                $params = array('uids' => $token['user_id'], 'fields' => 'uid,first_name,last_name,photo', 'access_token' => $token['access_token']);
                $userInfo = json_decode(url_get_contents('https://api.vk.com/method/friends.get' . '?' . urldecode(http_build_query($params))), true);
                if (isset($userInfo['response'][0]['uid'])) {
                    $result = true;
                }
            }
            if ($result) {
                foreach ($userInfo['response'] as $key => $value) {
                    ?>
                        <li>
                            <input type="checkbox" name="user_id" id="user_id" value="<?php 
                    echo $value['uid'];
                    ?>
">
                            <img src="<?php 
                    echo $value['photo'];
                    ?>
" alt="<?php 
                    echo $value['last_name'];
                    ?>
">
                            <a href="#"><?php 
                    echo $value['first_name'];
                    ?>
<br><?php 
                    echo $value['last_name'];
                    ?>
</a>
                        </li>
                    <?php 
                }
            }
        }
    }
function getCoordinates($address)
{
    $mapURL = "http://maps.googleapis.com/maps/api/geocode/json?address=" . urlencode($address) . "&sensor=true";
    $json = url_get_contents($mapURL);
    //$json = file_get_contents("json.ex");
    $data = json_decode($json, true);
    if (count($data['results']) == 0) {
        return array(0, 0, "No Map Results : {$address}\n");
    }
    if (count($data['results']) > 1) {
        return array(0, 0, "Too Many Map Results : {$address}");
    }
    $coords = $data['results'][0]['geometry']['location'];
    if (isset($coords['lat'])) {
        $lat = $coords['lat'];
        $lng = $coords['lng'];
    }
    return array($lat, $lng, "");
}
Exemplo n.º 10
0
 /**
  * @Title: getNoticeList
  * @Description: todo(获取公司公告新闻) 
  * @return string|multitype:  
  * @author 杨东 
  * @date 2013-7-4 下午5:52:32 
  * @throws 
  */
 public function getNoticeList()
 {
     $file = UPLOAD_PATH . "tml_news.htm";
     //filemtime($file)<time()-3600*24
     if (filemtime($file) < time() - 3600 * 24) {
         $url = "http://www.966580.com/?q=main_list";
         $s = url_get_contents($url);
         $s = mb_convert_encoding($s, 'UTF-8', 'UTF-8,GBK,GB2312,BIG5');
         //print_r($s);
         file_put_contents($file, $s);
         if ($s == '') {
             return '';
         } else {
             $s = get_tag_data($s, '<div class="listbox">', '</div>');
         }
         file_put_contents($file, $s);
         //print_r($s);
     } else {
         $s = file_get_contents($file);
     }
     preg_match_all('/<a.*?(?: |\\t|\\r|\\n)?href=[\'"]?(.+?)[\'"]?(?:(?: |\\t|\\r|\\n)+.*?)?>(.+?)<\\/a.*?>/sim', $s, $m);
     preg_match_all("/<font.*?>(.+?)<\\/font.*?>/", $s, $m1);
     /*preg_match_all('/<span.*?>(.+?)<\/span.*?>/',$s,$m1);*/
     $list = array();
     foreach ($m[1] as $key => $val) {
         $list[$key]['url'] = "http://www.966580.com/" . $val;
         //$list[$key]['url']="http://www.966580.com/".$val;
         $list[$key]['title'] = $m[2][$key];
         //$list[$key]['date']=$m1[0][$key];
         //$list[$key]['date']=$m1[1][$key];
         if ($key == 7) {
             break;
         }
     }
     return $list;
 }
Exemplo n.º 11
0
 protected function getOrigCache($src)
 {
     $localFile = $this->getBaseFile($src) . '.orig';
     $url = self::isValidURL($src);
     DiscoUtils::debug('About to download logo from [' . $src . ']');
     DiscoUtils::debug('And will store locally at  ' . $localFile);
     if ($url !== null) {
         DiscoUtils::debug('Logo found on valid location: ' . $url);
         $imagecontent = url_get_contents($url);
         if (empty($imagecontent)) {
             return null;
         }
         file_put_contents($localFile, $imagecontent);
         DiscoUtils::debug('Successfully obtained logo from the url');
         return $localFile;
     }
     $imagecontent = self::isValidEmbedded($src);
     if ($imagecontent !== null) {
         file_put_contents($localFile, $imagecontent);
         DiscoUtils::debug('Successfully obtained logo from embedded in metadata and stored a local cache');
         return $localFile;
     }
     return null;
 }
Exemplo n.º 12
0
function checkLink($url)
{
    // $data = file_get_contents($url);
    $data = url_get_contents($url);
}
Exemplo n.º 13
0
function sync_file($remote_url, $local_path)
{
    $remote_contents = url_get_contents($remote_url);
    if (strlen($remote_contents) == 0 or substr($remote_contents, 0, 1) != '{' and substr($remote_contents, 0, 5) != "<?php") {
        return "<!-- Remote file not valid: {$remote_url} -->";
    }
    $local_contents = file_get_contents($local_path);
    if (md5($remote_contents) == md5($local_contents)) {
        return "<!-- No changes needed to {$local_path} -->";
    }
    if (file_put_contents($local_path, $remote_contents)) {
        return "<!-- Synchronized {$local_path} -->";
    } else {
        return "<!-- Failed sync on {$path} -->";
    }
}
Exemplo n.º 14
0
include "includes/vars.php";
include "includes/functions.php";
$url = $_REQUEST['url'];
if (!$url) {
    // header('Content-type: image/svg+xml');
    // readfile('newimages/compact_disc.svg');
    header("HTTP/1.1 404 Not Found");
    exit(0);
} else {
    $url = str_replace("https://", "http://", $url);
    debuglog("Getting Remote Image " . $url, "TOMATO", 8);
    $ext = explode('.', $url);
    $outfile = 'prefs/imagecache/' . md5($url);
    if (!file_exists($outfile)) {
        debuglog("  Image is not cached", "TOMATO", 9);
        $aagh = url_get_contents($url);
        if ($aagh['status'] == "200") {
            debuglog("Cached Image " . $outfile, "TOMATO", 9);
            file_put_contents($outfile, $aagh['contents']);
        } else {
            debuglog("Failed to download " . $url . " - status was " . $aagh['status'], "TOMATO", 7);
            // header('Content-type: image/svg+xml');
            // readfile('newimages/compact_disc.svg');
            header("HTTP/1.1 404 Not Found");
            exit(0);
            exit(0);
        }
    }
    $mime = 'image/' . end($ext);
    $convert_path = find_executable("identify");
    $o = array();
Exemplo n.º 15
0
/**
 * Get urls from sitemap
 *
 * @param string $sitemap: url of sitemap.
 * @param int $timeout: time out in seconds.
 * @todo consider to use `simplexml_load_file()` and `simplexml_load_string()`.
 * @link http://www.php.net/manual/en/function.simplexml-load-file.php
 * @link http://php.net/manual/en/function.simplexml-load-string.php
 */
function get_urls_sitemap($sitemap, $timeout = TIMEOUT_OF_FETCHE)
{
    // Get contents of sitemap
    $xml = url_get_contents($sitemap, $timeout);
    // Get URLs from sitemap
    // @todo consider sub sitemap.
    $urls = array();
    if (preg_match_all("/\\<loc\\>(.+?)\\<\\/loc\\>/i", $xml, $matches) !== FALSE) {
        if (is_array($matches[1]) && !empty($matches[1])) {
            foreach ($matches[1] as $url) {
                $urls[] = trim($url);
            }
        }
    }
    return $urls;
}
Exemplo n.º 16
0
function loadXML($domain, $path)
{
    $t = url_get_contents($domain . $path);
    if ($t['status'] == "200") {
        return simplexml_load_string($t['contents']);
    }
    return false;
}
Exemplo n.º 17
0
 function parse_url($file, $debug = false)
 {
     if (get_cfg_var('allow_url_fopen')) {
         if (!($fp = fopen("{$file}", "r"))) {
             trigger_error("Error parse url {$file}");
             return;
         }
         while ($data = fread($fp, 4096)) {
             $this->parse($data, feof($fp));
         }
         fclose($fp);
     } else {
         // other url_fopen workarounds: curl, socket (http 80 only)
         $data = url_get_contents($file);
         if (empty($data)) {
             trigger_error("Error parse url {$file}");
             return;
         }
         $this->parse($data);
     }
 }
Exemplo n.º 18
0
<?php

// Get Sponsored cat ID
$sponsored_cat = get_category_by_slug('sponsored');
$sponsored_id = '-' . $sponsored_cat->cat_ID;
?>
    <div id="pattern-space" class="theme-pattern-bg"></div>
    <footer id="footer" class="u-align-center font-condensed">
      <div class="container">
        <div class="row">
          <div class="col s6">
            <a href="<?php 
echo home_url();
?>
"><?php 
echo url_get_contents(get_bloginfo('stylesheet_directory') . '/img/dist/8106-logo.svg');
?>
</a>
          </div>
          <div class="col s6">
            <ul>
<?php 
wp_list_categories(array('title_li' => '', 'orderby' => 'count', 'order' => 'DESC', 'hide_empty' => true, 'exclude' => $sponsored_id));
?>
            </ul>
          </div>
          <div class="col s6">
            <ul>
              <li><a href="https://twitter.com/8106" target="_blank">Twitter</a></li>
              <li><a href="https://www.facebook.com/8106tv" target="_blank">Facebook</a></li>
              <li><a href="http://8106.tumblr.com/" target="_blank">Tumblr</a></li>
Exemplo n.º 19
0
 function getimages($url)
 {
     $url = trim($url);
     if (strpos(strtoupper(trim($url)), "HTTP") === 0) {
         //do nothing
     } else {
         $url = "http://" . $url;
     }
     $html3 = file_get_contents($url);
     if (isset($ret)) {
         $ret = $this->processhtml($html3, $url, $ret);
     } else {
         $ret = $this->processhtml($html3, $url, array());
     }
     if (count($ret) < 3) {
         if (!function_exists('curl_init')) {
             die('CURL is not installed!');
         }
         $ch = curl_init();
         $thepage = get_web_page($url);
         $html1 = $thepage['content'];
         $ret = processhtml($html1, $url, $ret);
     }
     if (count($ret) < 3) {
         $timeout = 15;
         curl_setopt($ch, CURLOPT_URL, $url);
         curl_setopt($ch, CURLOPT_ENCODING, "");
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
         $html2 = curl_exec($ch);
         curl_close($ch);
         $ret = processhtml($html2, $url, $ret);
     }
     if (count($ret) < 3) {
         $html4 = url_get_contents($url);
         $ret = processhtml($html4, $url, $ret);
     }
     if (count($ret) < 3) {
         $html5 = urlload($url);
         $ret = processhtml($html5, $url, $ret);
     }
     //foreach ($ret as $key=>$value) {
     //	$img = explode("\n", $value);
     //	if (($img[1] == 99) && ($img[2] == 99)) {
     //
     //		$thumbnail = imagecreatefromstring(file_get_contents($img[3]));
     //		$width = imagesx($thumbnail);
     //		$height = imagesy($thumbnail);
     //		ImageDestroy($thumbnail);
     //		if (trim($width) != "") {
     //			$value = sprintf('%07d', $height + $width) . "\n" . sprintf('%06d', $height) . "\n" . sprintf('%06d', $width) . "\n" . $img[3]
     //		}
     //	}
     //}
     //rsort($ret);
     return $ret;
 }
Exemplo n.º 20
0
function adicionar_novo_host($endereco_url_site)
{
    global $nome_banco;
    // nome do banco de dados a salvar
    global $numero_maximo_registros_busca_inteligente;
    // numero maximo de registros por banco de dados
    global $banco_dados_atingiu_limite_resposta;
    // informa se para ou continua adicao de novos sites
    global $array_links_host_diferente;
    // array com links de hosts diferentes
    if ($endereco_url_site == null) {
        return false;
        // retorna falso
    }
    $dados_cabecalho_host_url = parse_url($endereco_url_site);
    // dados
    $protocolo_host_site = $dados_cabecalho_host_url['scheme'];
    // protocolo do host do site
    if ($protocolo_host_site == null) {
        $endereco_url_site = "http://" . $endereco_url_site;
        // adiciona protocolo http ao host do site
    }
    mysql_select_db($nome_banco);
    // seleciona banco de dados
    $numero_registros_banco_dados = retorne_numero_registros_banco_dados($nome_banco);
    // retorna o numero de registros no banco de dados
    if ($numero_registros_banco_dados > $numero_maximo_registros_busca_inteligente) {
        $banco_dados_atingiu_limite_resposta = true;
        // informa para parar
    }
    $codigo_html_site = url_get_contents($endereco_url_site);
    // codigo html do site
    $codigo_html_site = codificacao_unicode($codigo_html_site);
    // codificando
    $dados_gerais_site = retorne_dados_gerais_site($codigo_html_site, $endereco_url_site);
    // dados gerais do site
    $enderecos_url_site_array = retorna_links_endereco_url($codigo_html_site, $endereco_url_site);
    // enderecos url de site
    $imagens_site_array_url = retorna_imagens_endereco_url($codigo_html_site, $endereco_url_site);
    // imagens do site
    $dados_links = separa_dados_obtidos_links_salvar($enderecos_url_site_array);
    // dados de links
    if (count($dados_links) == 0) {
        return null;
        // retorno nulo
    }
    $contador = 0;
    // contador
    for ($contador == $contador; $contador <= count($dados_links); $contador++) {
        $titulo_link_lista .= $dados_links[$contador][0];
        // titulos de links
        $url_link_lista .= $dados_links[$contador][1];
        // titulos de links
    }
    $contador = 0;
    // contador
    for ($contador == $contador; $contador <= count($array_links_host_diferente); $contador++) {
        $titulo_link_host_diferente_lista .= $dados_links[$contador][0];
        // titulos de links
        $url_link_host_diferente_lista .= $dados_links[$contador][1];
        // titulos de links
    }
    $dados_imagens = $imagens_site_array_url;
    // dados array de imagens
    $contador = 0;
    // contador
    for ($contador == $contador; $contador <= count($dados_imagens); $contador++) {
        $dados_array_imagem = $dados_imagens[$contador];
        // dados
        $imagem_url_lista .= $dados_array_imagem[$contador][0];
        // url
        $imagem_titulo_lista .= $dados_array_imagem[$contador][1];
        // titulo
        $imagem_alt_lista .= $dados_array_imagem[$contador][2];
        // alt
    }
    $titulo_site = $dados_gerais_site['title'];
    // titulo do site
    $url_pagina = $endereco_url_site;
    // url da pagina
    $descricao_site = $dados_gerais_site['description'];
    // descricao do site
    $palavras_chave_site = $dados_gerais_site['keywords'];
    // palavras chave do site
    $host_site = retorna_host_url($endereco_url_site);
    // host do site
    $tabela_salvar_site = retorne_tabela_salvar_site();
    // tabela para salvar o site
    $data = date('d:m:y');
    // data
    $host_site = remove_html($host_site);
    // remove codigo especial
    $url_pagina = remove_html($url_pagina);
    // remove codigo especial
    $titulo_site = remove_html($titulo_site);
    // remove codigo especial
    $palavras_chave_site = remove_html($palavras_chave_site);
    // remove codigo especial
    $descricao_site = remove_html($descricao_site);
    // remove codigo especial
    $url_link_lista = remove_html($url_link_lista);
    // remove codigo especial
    $url_link_host_diferente_lista = remove_html($url_link_host_diferente_lista);
    // remove codigo especial
    $imagem_url_lista = remove_html($imagem_url_lista);
    // remove codigo especial
    $conteudo_site = remove_html($codigo_html_site);
    // remove codigo especial
    $data = remove_html($data);
    // remove codigo especial
    $query_atualizar_tabela .= "'null', ";
    // query para atualizar tabela
    $query_atualizar_tabela .= "'{$url_pagina}', ";
    // query para atualizar tabela
    $query_atualizar_tabela .= "'{$host_site}', ";
    // query para atualizar tabela
    $query_atualizar_tabela .= "'{$titulo_site}', ";
    // query para atualizar tabela
    $query_atualizar_tabela .= "'{$palavras_chave_site}', ";
    // query para atualizar tabela
    $query_atualizar_tabela .= "'{$descricao_site}', ";
    // query para atualizar tabela
    $query_atualizar_tabela .= "'{$url_link_lista}', ";
    // query para atualizar tabela
    $query_atualizar_tabela .= "'{$url_link_host_diferente_lista}', ";
    // query para atualizar tabela
    $query_atualizar_tabela .= "'{$imagem_url_lista}', ";
    // query para atualizar tabela
    $query_atualizar_tabela .= "'{$conteudo_site}', ";
    // query para atualizar tabela
    $query_atualizar_tabela .= "'{$data}'";
    // query para atualizar tabela
    $host_cadastrado_resposta = retorne_host_cadastrado_existe($host_site);
    // resposta se o host esta cadastrado ou e novo
    if ($host_site != null) {
        $query[1] = "delete from {$tabela_salvar_site} where host_site='{$host_site}';";
        // query para remover dados
        $query[2] = "insert into {$tabela_salvar_site} values({$query_atualizar_tabela});";
        // query
        if ($host_cadastrado_resposta == false) {
            comando_executa($query[2]);
            // executa o comando query
        } else {
            comando_executa($query[1]);
            // executa o comando query
            comando_executa($query[2]);
            // executa o comando query
        }
    }
    $mensagem_sucesso .= "{$host_site}";
    // mensagem de sucesso
    $mensagem_sucesso .= "&nbsp;";
    // mensagem de sucesso
    $mensagem_sucesso .= "adicionado com sucesso.";
    // mensagem de sucesso
    echo $mensagem_sucesso;
    // mensagem de sucesso
}
/**
 * Appel au serveur communautaire pour envoyer un fichier uploadé par un utilisateur.
 * 
 * @param int       $sesamath_id
 * @param string    $sesamath_key
 * @param string    $matiere_ref
 * @param string    $fichier_nom
 * @param string    $fichier_contenu
 * @return string   url du fichier ou un message d'erreur
 */
function uploader_ressource($sesamath_id,$sesamath_key,$matiere_ref,$fichier_nom,$fichier_contenu)
{
	$tab_post = array();
	$tab_post['fichier']         = 'ressource_uploader';
	$tab_post['sesamath_id']     = $sesamath_id;
	$tab_post['sesamath_key']    = $sesamath_key;
	$tab_post['matiere_ref']     = $matiere_ref;
	$tab_post['fichier_nom']     = $fichier_nom;
	$tab_post['fichier_contenu'] = base64_encode($fichier_contenu);
	$tab_post['version_prog']    = VERSION_PROG; // Le service web doit être compatible
	$tab_post['adresse_retour']  = URL_INSTALL_SACOCHE;
	$tab_post['integrite_key']   = fabriquer_chaine_integrite();
	return url_get_contents(SERVEUR_COMMUNAUTAIRE,$tab_post,30 /*timeout*/);
}
Exemplo n.º 22
0
          socket.on("status", function (data) {
            
            console.log(data);
          });
          socket.on("measurement", function (data) {
              
            console.log(data);
          });
          socket.on("location", function (data) {
              
            console.log(data);
          });
          */
        </script>-->
        <?php 
$json_data = url_get_contents("http://api.pioupiou.fr/v1/live/110");
$json = new Services_JSON();
$datas = $json->decode($json_data);
?>
        <div class="pioupiou-datas">
            <!--<div class="pioupiou-left">
                <h4>Informations g&eacute;n&eacute;rales:</h4>
                <strong>Balise: </strong><span id="balise"></span><?php 
print $datas->data->meta->name;
?>
<br />
                <strong>Lattitude: </strong><?php 
print $datas->data->location->latitude;
?>
<br />
                <strong>Longitude: </strong><?php 
$dt = date("Y-m-d H:i:s");
$id = !empty($_GET["id"]) ? $_GET["id"] : 0;
$r = $wpdb->get_row("select * from " . RKSTABLE . " where id=" . $id);
if (null !== $r) {
    $url = $r->url;
    $matchcontent = $r->content;
    $yesorno = $r->issoldout;
    $matchtype = stripslashes($r->matchtype);
}
if (empty($id)) {
    echo "id is empty";
    exit;
}
//读取源代码
//$page = file_get_contents($url);
$page = url_get_contents($url);
if ($matchtype == "regex") {
    $ismatch = preg_match($matchcontent, $page);
} else {
    $ismatch = strstr($page, $matchcontent);
}
if ($ismatch) {
    if ($yesorno) {
        soldoutlog($id, $dt, "havegoods");
        echo "havegoods";
        echo "||";
        echo $dt;
    } else {
        soldoutlog($id, $dt, "soldout");
        echo "soldout";
        echo "||";
Exemplo n.º 24
0
function xss($link)
{
    $all = parse_url($link);
    if (strpos($link, '=') !== false) {
        $linki = array();
        $zmienne = explode("?", $link);
        $zmienne2 = explode("&", $zmienne[1]);
        foreach ($zmienne2 as $zmienna) {
            $rozbite = explode("=", $zmienna);
            $linki[] .= str_replace($rozbite[0] . "=" . $rozbite[1], $rozbite[0] . "=" . urlencode("'>\"><script>alert(6661337);</script>"), $link);
        }
        foreach ($linki as $lin) {
            if (strpos(file_get_contents($lin), "<script>alert(6661337);</script>")) {
                $text = urldecode($lin) . "\n";
                $handle = fopen('out/xss.txt', 'a');
                fwrite($handle, $text);
                fclose($handle);
                print "1";
            } else {
                print '0';
            }
        }
    } else {
        $all = parse_url($link);
        $url = $link . "'>\"><script>alert(6661337);</script>";
        if (strpos(url_get_contents($url), "<script>alert(6661337);</script>")) {
            $text = $url . "\n";
            $handle = fopen('out/xss.txt', 'a');
            fwrite($handle, $text);
            fclose($handle);
            print "I";
        } else {
            print 'O';
        }
    }
}
Exemplo n.º 25
0
function save_location($post_id)
{
    // get location values from post
    $location = get_post_meta($post_id, 'choose_location', true);
    // set HTTP header
    $headers = array('Content-Type: application/json');
    $url = 'http://maps.googleapis.com/maps/api/geocode/json?latlng=' . $location . '&sensor=false';
    //Get JSSON
    $result = url_get_contents($url);
    //save in custom field called weather
    update_post_meta($post_id, 'city', wp_slash($result));
}
Exemplo n.º 26
0
 function run($dbi, $argstr, &$request, $basepage)
 {
     /* ignore fatal on loading */
     /*
     global $ErrorManager;
     $ErrorManager->pushErrorHandler(new WikiMethodCb($this,'_error_handler'));
     */
     // Require the XML_FOAF_Parser class. This is a pear library not included with phpwiki.
     // see doc/README.foaf
     if (findFile('XML/FOAF/Parser.php', 'missing_ok')) {
         require_once 'XML/FOAF/Parser.php';
     }
     //$ErrorManager->popErrorHandler();
     if (!class_exists('XML_FOAF_Parser')) {
         return $this->error(_("required pear library XML/FOAF/Parser.php not found in include_path"));
     }
     extract($this->getArgs($argstr, $request));
     // Get our FOAF File from the foaf plugin argument or $_GET['foaf']
     if (empty($foaf)) {
         $foaf = $request->getArg('foaf');
     }
     $chooser = HTML::form(array('method' => 'get', 'action' => $request->getURLtoSelf()), HTML::h4(_("FOAF File URI")), HTML::input(array('id' => 'foaf', 'name' => 'foaf', 'type' => 'text', 'size' => '80', 'value' => $foaf)), HTML::br(), HTML::input(array('id' => 'pretty', 'name' => 'pretty', 'type' => 'radio', 'checked' => 'checked'), _("Pretty HTML")), HTML::input(array('id' => 'original', 'name' => 'original', 'type' => 'radio'), _("Original URL (Redirect)")), HTML::br(), HTML::input(array('type' => 'submit', 'value' => _("Parse FOAF"))));
     if (empty($foaf)) {
         return $chooser;
     } else {
         //Error Checking
         if (substr($foaf, 0, 7) != "http://") {
             return $this->error(_("foaf must be a URI starting with http://"));
         }
         // Start of output
         if (!empty($original)) {
             $request->redirect($foaf);
         } else {
             $foaffile = url_get_contents($foaf);
             if (!$foaffile) {
                 //TODO: get errormsg
                 return HTML(HTML::p("Resource isn't available: Something went wrong, probably a 404!"));
             }
             // Create new Parser object
             $parser = new XML_FOAF_Parser();
             // Parser FOAF into $foaffile
             $parser->parseFromMem($foaffile);
             $a = $parser->toArray();
             $html = HTML(HTML::h1(@$a[0]["name"]), HTML::table(HTML::thead(), HTML::tbody(@$a[0]["title"] ? HTML::tr(HTML::td(_("Title")), HTML::td($a[0]["title"])) : null, @$a[0]["homepage"][0] ? $this->iterateHTML($a[0], "homepage", $a["dc"]) : null, @$a[0]["weblog"][0] ? $this->iterateHTML($a[0], "weblog", $a["dc"]) : null, HTML::tr(HTML::td("Full Name"), @$a[0]["name"][0] ? HTML::td(@$a[0]["name"]) : null), @$a[0]["nick"][0] ? $this->iterateHTML($a[0], "nick", $a["dc"]) : null, @$a[0]["mboxsha1sum"][0] ? $this->iterateHTML($a[0], "mboxsha1sum", $a["dc"]) : null, @$a[0]["depiction"][0] ? $this->iterateHTML($a[0], "depiction", $a["dc"]) : null, @$a[0]["seealso"][0] ? $this->iterateHTML($a[0], "seealso", $a["dc"]) : null, HTML::tr(HTML::td("Source"), HTML::td(HTML::a(array('href' => @$foaf), "RDF"))))));
             if (DEBUG) {
                 $html->pushContent(HTML::hr(), $chooser);
             }
             return $html;
         }
     }
 }
Exemplo n.º 27
0
<?php

chdir('../..');
include "includes/vars.php";
include "includes/functions.php";
$uri = rawurldecode($_REQUEST['uri']);
debuglog("Getting " . $uri, "GETBEETSINFO");
$content = url_get_contents($uri);
$s = $content['status'];
debuglog("Response Status was " . $s, "GETBEETSINFO");
if ($s == "200") {
    print $content['contents'];
} else {
    header("HTTP/1.1 404 Not Found");
}
Exemplo n.º 28
0
<?php

chdir('..');
ob_start();
include "includes/vars.php";
include "includes/functions.php";
debuglog("Requesting IP address location lookup", "GETLOCATION");
$content = url_get_contents("http://freegeopip.net/json");
if ($content['status'] == "200") {
    print $content['contents'];
} else {
    debuglog("Request to freegeoip.net failed with status " . $content['status'], "GETLOCATION");
    print json_encode(array('country' => 'ERROR', 'country_code' => 'unclepeter'));
}
ob_flush();
Exemplo n.º 29
0
<div id="menu-holder" class="yellow-background">
  <nav id="menu" class="container">

    <div id="menu-logo"><?php 
echo url_get_contents(get_stylesheet_directory_uri() . '/img/silke_logo.svg');
?>
</div>

    <ul id="menu-list" class="font-bold">
      <li class="js-scroll-to-trigger u-pointer" data-target="us">Us</li>
      <li class="js-scroll-to-trigger u-pointer" data-target="work">Work</li>
      <li class="js-scroll-to-trigger u-pointer" data-target="contact">Contact</li>
    </ul>

  </nav>
</div>
Exemplo n.º 30
0
 /**
  * fromFile - read pictures & descriptions (separated by ;)
  *            from $src and return it in array $photos
  *
  * @param string $src path to dir or textfile (local or remote)
  * @param array $photos
  * @return string Error when bad url or file couldn't be opened
  */
 function fromFile($src, &$photos, $webpath = '')
 {
     $src_bak = $src;
     //there has a big security hole... as loading config/config.ini !
     if (!preg_match('/(\\.csv|\\.jpg|\\.jpeg|\\.png|\\.gif|\\/)$/', $src)) {
         return $this->error(_("File extension for csv file has to be '.csv'"));
     }
     if (!IsSafeURL($src)) {
         return $this->error(_("Bad url in src: remove all of <, >, \""));
     }
     if (preg_match('/^(http|ftp|https):\\/\\//i', $src)) {
         $contents = url_get_contents($src);
         $web_location = 1;
     } else {
         $web_location = 0;
     }
     if (!file_exists($src) and @file_exists(PHPWIKI_DIR . "/{$src}")) {
         $src = PHPWIKI_DIR . "/{$src}";
     }
     // check if src is a directory
     if (file_exists($src) and filetype($src) == 'dir') {
         //all images
         $list = array();
         foreach (array('jpeg', 'jpg', 'png', 'gif') as $ext) {
             $fileset = new fileSet($src, "*.{$ext}");
             $list = array_merge($list, $fileset->getFiles());
         }
         // convert dirname($src) (local fs path) to web path
         natcasesort($list);
         if (!$webpath) {
             // assume relative src. default: "themes/Hawaiian/images/pictures"
             $webpath = DATA_PATH . '/' . $src_bak;
         }
         foreach ($list as $file) {
             // convert local path to webpath
             $photos[] = array("src" => $file, "name" => $webpath . "/{$file}", "name_tile" => $src . "/{$file}", "src" => $src . "/{$file}", "desc" => "");
         }
         return;
     }
     // check if $src is an image
     foreach (array('jpeg', 'jpg', 'png', 'gif') as $ext) {
         if (preg_match("/\\.{$ext}\$/", $src)) {
             if (!file_exists($src) and @file_exists(PHPWIKI_DIR . "/{$src}")) {
                 $src = PHPWIKI_DIR . "/{$src}";
             }
             if ($web_location == 1 and !empty($contents)) {
                 $photos[] = array("src" => $src, "name" => $src, "name_tile" => $src, "src" => $src, "desc" => "");
                 return;
             }
             if (!file_exists($src)) {
                 return $this->error(fmt("Unable to find src='%s'", $src));
             }
             $photos[] = array("src" => $src, "name" => "../" . $src, "name_tile" => $src, "src" => $src, "desc" => "");
             return;
         }
     }
     if ($web_location == 0) {
         $fp = @fopen($src, "r");
         if (!$fp) {
             return $this->error(fmt("Unable to read src='%s'", $src));
         }
         while ($data = fgetcsv($fp, 1024, ';')) {
             if (count($data) == 0 || empty($data[0]) || preg_match('/^#/', $data[0]) || preg_match('/^[[:space:]]*$/', $data[0])) {
                 continue;
             }
             if (empty($data[1])) {
                 $data[1] = '';
             }
             $photos[] = array("name" => dirname($src) . "/" . trim($data[0]), "location" => "../" . dirname($src) . "/" . trim($data[0]), "desc" => trim($data[1]), "name_tile" => dirname($src) . "/" . trim($data[0]));
         }
         fclose($fp);
     } elseif ($web_location == 1) {
         //TODO: checks if the file is an image
         $contents = preg_split('/\\n/', $contents);
         while (list($key, $value) = each($contents)) {
             $data = preg_split('/\\;/', $value);
             if (count($data) == 0 || empty($data[0]) || preg_match('/^#/', $data[0]) || preg_match('/^[[:space:]]*$/', $data[0])) {
                 continue;
             }
             if (empty($data[1])) {
                 $data[1] = '';
             }
             $photos[] = array("name" => dirname($src) . "/" . trim($data[0]), "src" => dirname($src) . "/" . trim($data[0]), "desc" => trim($data[1]), "name_tile" => dirname($src) . "/" . trim($data[0]));
         }
     }
 }