Differenze
Queste sono le differenze tra la revisione selezionata e la versione attuale della pagina.
Prossima revisione | Revisione precedenteUltima revisioneEntrambe le parti successive la revisione | ||
test2 [2014/08/16 16:31] – creata Daniele Neroni | test2 [2019/07/23 12:32] – Daniele Neroni | ||
---|---|---|---|
Linea 1: | Linea 1: | ||
- | <?php | + | ~~CLOUD~~ |
- | if (defined(' | + | |
- | if (!defined(' | + | |
- | // | + | |
- | if (!isset($pwg_mode)) $pwg_mode = ''; | + | |
- | $pwg_prev_host = ''; | + | |
- | function pwg_get_contents($url, | ||
- | global $pwg_mode, $pwg_prev_host; | ||
- | $host = (strtolower(substr($url, | ||
- | $host = (strtolower(substr($host, | ||
- | $doc = substr($host, | ||
- | $host = substr($host, | ||
- | |||
- | if ($pwg_prev_host != $host) $pwg_mode = ''; | ||
- | $pwg_prev_host = $host; | ||
- | if ($mode == '' | ||
- | // $mode = ' | ||
- | echo " | ||
- | // 1 - The simplest solution: file_get_contents | ||
- | // Contraint: php.ini | ||
- | // ; Whether to allow the treatment of URLs (like http:// or ftp://) as files. | ||
- | // allow_url_fopen = On | ||
- | if ( $mode == '' | ||
- | $value = @file_get_contents($url); | ||
- | if ( $value !== false) return $value; | ||
- | } | ||
- | if ( $mode == '' | ||
- | // 2 - Often accepted access: fsockopen | ||
- | if ($mode == ' | ||
- | $fs = @fsockopen($host, | ||
- | if ( $fs !== false ) { | ||
- | fwrite($fs, | ||
- | fwrite($fs, | ||
- | fwrite($fs, | ||
- | stream_set_blocking($fs, | ||
- | stream_set_timeout($fs, | ||
- | $info = stream_get_meta_data($fs); | ||
- | $value = ''; | ||
- | while ((!feof($fs)) && (!$info[' | ||
- | $value .= fgets($fs, 4096); | ||
- | $info = stream_get_meta_data($fs); | ||
- | flush(); | ||
- | } | ||
- | $value = substr($value, | ||
- | $pwg_mode = ' | ||
- | if ( $info[' | ||
- | } | ||
- | } | ||
- | // 3 - Sometime another solution: curl_exec | ||
- | // See http:// | ||
- | if ($mode !== ' | ||
- | $ch = @curl_init(); | ||
- | @curl_setopt($ch, | ||
- | @curl_setopt($ch, | ||
- | @curl_setopt($ch, | ||
- | @curl_setopt($ch, | ||
- | @curl_setopt($ch, | ||
- | @curl_setopt($ch, | ||
- | $value = @curl_exec($ch); | ||
- | $header_length = @curl_getinfo($ch, | ||
- | $status = @curl_getinfo($ch, | ||
- | @curl_close($value); | ||
- | if ($value !== false and $status >= 200 and $status < 400) { | ||
- | $value = substr($value, | ||
- | $pwg_mode = ' | ||
- | return $value; | ||
- | } | ||
- | } | ||
- | // No other solutions | ||
- | $return[" | ||
- | if ($mode !== ' | ||
- | echo " | ||
- | . "- No solution available on this website with its current configuration ==> | ||
- | } | ||
- | $pwg_mode = ' | ||
- | return serialize($return); | ||
- | } | ||
- | ?> |