Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (isset($_GET["rep3"])) {
- send_cap();
- }
- function send_cap() {
- $url='http://blogs.yandex.ru/checkcaptcha?rep='.$_GET["rep3"];
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_HEADER,1);
- //curl_setopt($ch, CURLOPT_POST,1)
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_TIMEOUT, 10);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
- curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)");
- $result = curl_exec($ch);
- $result = mb_convert_encoding($result,'windows-1251');
- echo $result;
- }
- //-------------------------------------------------------
- function load_page_alt($url) {
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_HEADER, 1);
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_TIMEOUT, 10);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)");
- curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
- $result = curl_exec($ch);
- curl_close($ch);
- $ftg = mb_detect_encoding($result);
- echo 'encoding:'.$ftg.'<br/>';
- $result = mb_convert_encoding($result, 'windows-1251', $ftg);
- $zzuu = '"'.$_SERVER["PHP_SELF"].'"';
- $zzstr = <<<INF
- <script type="text/javascript">
- function submuu(f) {
- var zwin = open ( {$zzuu}+"?rep3="+encodeURIComponent(f.rep3.value));
- }
- </script>
- <form action="#" onsubmit="submuu(this);return false;" method="GET">
- <input type="TEXT" name="rep3" />
- <input type="SUBMIT" name="subm3" value="send" />
- </form>
- INF;
- echo $zzstr;
- echo '<pre>'.htmlentities(print_r($result)).'</pre>';
- }
- //-------------------------------------------------------
- function load_page($url) {
- $opts = array (
- 'http' => array(
- 'method'=>'GET',
- 'header'=>''
- ));
- $context = stream_context_create($opts);
- $m = get_meta_tags($url);
- echo '<pre>'.print_r($m,true).'</pre>';
- $s = file_get_contents($url,false, $context);
- $s3 = preg_match_all('/<meta[^>]*(name|http-equiv)\s*=\s*"([^">]*?)".*?content=[^"]*?"([^">]*?)"[^>]*>/ims',
- $s, $matches, PREG_SET_ORDER);
- //echo '<pre>'.htmlentities(print_r($matches,true)).'</pre>';
- $teststr = $matches[1][0];
- for ($i=0; $i<strlen($teststr); $i++) {
- //echo sprintf (' %s - %d <br>',$teststr{$i}, ord($teststr{$i}));
- }
- $metas = array();
- for ($i=0; $i<count($matches); $i++) {
- $metas[$matches[$i][2]]=$matches[$i][3];
- }
- $metas = array_change_key_case($metas, CASE_UPPER);
- if (array_key_exists('CONTENT-TYPE',$metas))
- if (stripos($metas['CONTENT-TYPE'],'utf')!=-1)
- $s= iconv( 'utf-8','windows-1251', $s);
- echo '<pre>'.htmlentities(print_r($metas,true)).'</pre>';
- echo $s;
- }
- //-------------------------------------------------------
- $db = new mysqli('localhost','','','');
- if (mysqli_connect_errno()) {
- echo mysql_connect_error();
- exit();
- }
- $sql = 'create table words ( id int(11) not null auto_increment,
- word varchar(50), primary key (`id`))';
- if (!$db->query($sql)) {
- echo $db->error;
- $sql = 'delete from words';
- if (!$db->query($sql)) {
- echo $db->error.'<br>';
- }
- }
- $urlbase = 'http://blogs.yandex.ru/search.xml?';
- $qs = http_build_query (array('text'=>'концерт'));
- $url= $urlbase.$qs;
- echo $url;
- $headers =get_headers($url);
- //-----------------------------------------------
- function zsplit($el) {
- $z = explode(':',$el);
- $lpart = array_shift($z);
- return $lpart;
- }
- //-----------------------------------------------
- function zsplit4($el) {
- $z = explode(':',$el);
- $rpart = array_pop($z);
- return $rpart;
- }
- //-----------------------------------------------
- $headers3 = array_map('zsplit',$headers);
- $headers4 = array_map('zsplit4',$headers);
- $headers = array_combine($headers3, $headers4);
- echo '<pre>'.print_r($headers, true).'</pre>';
- load_page_alt($url);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement