пятница, 30 декабря 2011 г.

Постилка в Google+ (plus.google.com)



 function ShareBoxPost()
 {
  // linkpreview
  $this-> Gen_reqid();

  $headers = $this->set_headers();
  //$headers[] = "Expect: ";
  $curl_data['headers'] =  $headers;
  #$curl_data['referer'] = "";
  $curl_data['echo_header'] = true;
  $curl_data['followlocation'] = true;

  $headers[] = "application/x-www-form-urlencoded;charset=utf-8";
  $curl_data['headers'] =  $headers;


  $p = array(
  "at" => $this-> atToken,
  "susp" => true,
  );

  $curl_data['post'] = http_build_query($p);
  $curl_data['url'] = 'https://plusone.google.com/_/sharebox/linkpreview/?c='.urlencode($this-> url_spam).'&t=1&slpf=1&ml=1&_reqid='.$this-> _reqid.'&rt=j';

  $this->code = $this->curl($curl_data);
  write_string("logs/".$this->host."_plus_google_sharebox_linkpreview.html", $this->code);

  preg_match_all ('~\[(.*),(.*),"(.*)"\]~', $this->code, $m);
  $thumb_url = $m[3][0];
  $thumb_info = getimagesize($thumb_url );

  $t = parse_url ($this->url_spam);
  $url_spam_host = $t['host'];

  $oz =str_replace(':'.$this->userID, '', $this-> atToken);
  $t = time();

  $p = array(
  'at' => $this-> atToken,
  //'source' => 'widget',
  'spar' => '["","oz:'.$this-> userID.'.'.$t.'.0",null,null,null,null,"[\"[null,null,null,\\\\\"'.$this->post_title.'\\\\\",null,null,null,null,null,[],null,null,null,null,null,null,null,null,null,null,null,\\\\\"'.$this->post_title.'\\\\\",null,null,[null,\\\\\"'.$this->url_spam.'\\\\\",null,\\\\\"text/html\\\\\",\\\\\"document\\\\\"],null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[[null,\\\\\"//s2.googleusercontent.com/s2/favicons?domain\u003d'.$url_spam_host.'\\\\\",null,null],[null,\\\\\"//s2.googleusercontent.com/s2/favicons?domain\u003d'.$url_spam_host.'\\\\\",null,null]],null,null,null,null,null,[[null,\\\\\"\\\\\",\\\\\"http://google.com/profiles/media/provider\\\\\",\\\\\"\\\\\"]]]\",\"[null,null,null,null,null,[null,\\\\\"'.$thumb_url.'\\\\\"],null,null,null,[],null,null,null,null,null,null,null,null,null,null,null,null,null,null,[null,\\\\\"'.$this->url_spam.'\\\\\",null,\\\\\"image/jpeg\\\\\",\\\\\"photo\\\\\",null,null,null,null,null,null,null,'.$thumb_info[0].','.$thumb_info[1].'],null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[[null,\\\\\"'.$thumb_url.'\\\\\",null,null],[null,\\\\\"'.$thumb_url.'\\\\\",null,null]],null,null,null,null,null,[[null,\\\\\"images\\\\\",\\\\\"http://google.com/profiles/media/provider\\\\\",\\\\\"\\\\\"]]]\"]",null,"{\"aclEntries\":[{\"scope\":{\"scopeType\":\"anyone\",\"name\":\"Anyone\",\"id\":\"anyone\",\"me\":true,\"requiresKey\":false},\"role\":20},{\"scope\":{\"scopeType\":\"anyone\",\"name\":\"Anyone\",\"id\":\"anyone\",\"me\":true,\"requiresKey\":false},\"role\":60}]}",true,[],false,false,null,[],false,false,null,null,null,null,[8,null,[null,null,null,null,[["'.$this->url_spam.'"],"'.$url_spam_host.'"]]],null,null,null,null,null,false,false,false]',

   );
  $headers[] = "Pragma: no-cache";
  $headers[] = "Cache-Control: no-cache";
  $headers[] = "Connection: keep-alive";
  $headers[] = "X-Same-Domain: 1";
  //$headers[] = "Expect: ";
  $curl_data['headers'] =  $headers;
  $curl_data['post'] = http_build_query($p);
  $curl_data['url'] = 'https://plusone.google.com/_/sharebox/post/?spam=25&_reqid='.$this-> Gen_reqid().'&rt=j';

  $this->code = $this->curl($curl_data);
  write_string("logs/".$this->host."_plus_google_sharebox_post.html", $this->code);

  echo $this->code;

  if (stripos($this->code, 'error') )
  {
   echo "

Not Allowed, случилась какая-то хуйета!


"; echo $this->code; return false; } else { echo "

sharebox post !!!


"; return true ; } } function Gen_reqid() { $a = (string) floor(mt_rand (1111111,9999999)); $this-> _reqid ="0". $a; return $this-> _reqid; } function GetAtToken() { if(preg_match_all('~",,,,"https://www.google.com/csi","(.*):(.*)",,,~iU', $this-> code, $m)) if($m[1][0] and $m[2][0]) { $this-> atToken = $m[1][0] .':'.$m[2][0]; return true; } }

четверг, 15 декабря 2011 г.

Cкрипт автоматической отправки SMS beeline

Нужно написать скрипт, который будет отправлять автоматически, на один и тот же номер, смс, через определенное время.
header('Content-Type: text/html; charset=utf8');
// ignore_user_abort();



require_once("include/beeline_ru.class.php");
require_once("include/curl.class.php");
require_once("include/recognize.captcha.class.php");


$rc = New RecognitionCaptcha();
$ch = New CurlClass();

$bl = New BeeLineRuClass();
$bl->dirtysmstext = 'Сообщение';
$bl->phone = '79051234567';

$bl->sendSMS();




Функция отправки сообщения
class BeeLineRuClass
 function sendSMS()
 {
  global $ch;
  print "
BeeLineRuClass->sendSMS()
\n"; $headers = $ch->set_headers(); #$headers[] = "Expect: "; $curl_data['headers'] = $headers; $curl_data['followlocation'] = true; $curl_data['echo_header'] = true; $curl_data['url'] = "https://www.beeline.ru/sms/index.wbp"; $curl_data['referer'] = ''; $this->code = $ch->curl($curl_data); $this-> write_string("logs/beeline_index.wbp.html", $this->code); //echo $this->code; $this-> GetAfCode(); if($this-> afcode == '') { echo "return false afcode"; return false; } $this-> GetConfirmCode(); if($this-> confirmcode == '') { echo "return false confirmcode (capthca)"; return false; } if($this-> dirtysmstext) { $this->smstext = $this-> mso_slug($this-> dirtysmstext); } else { echo "return false dirtysmstext"; return false; } $this->smsto = substr($this->phone, 4); $this->smstoprefix = substr($this->phone, 1, 3); $post_data = array ( "afcode" => $this-> afcode, "confirm_key" => $this-> confirm_key, "confirmcode" => $this-> confirmcode, "dirtysmstext" => iconv('utf-8', 'cp1251', $this-> dirtysmstext), //"dirtysmstext" => $this-> dirtysmstext, "send" => '', "smstext" => $this-> smstext, "smsto" => $this-> smsto, "smstoprefix" => $this-> smstoprefix, "translit" => '', "x" => 0, "y" => 0, ); $curl_data['post'] = http_build_query($post_data); $headers = $ch->set_headers(); #$headers[] = "Expect: "; $curl_data['headers'] = $headers; $curl_data['followlocation'] = true; $curl_data['echo_header'] = true; $curl_data['referer'] = "https://www.beeline.ru/sms/index.wbp"; $curl_data['url'] = "https://www.beeline.ru/sms/index.wbp"; //$curl_data['referer'] = ''; echo "

\$post_data:

"; print_r($post_data); echo "

\$curl_data:


"; print_r($curl_data); $this->code = $ch->curl($curl_data); $this-> write_string("logs/beeline_send_sms.html", $this->code); //echo $this->code; }
Для работы нужно antigate_API_KEY и captchabot_API_KEY

суббота, 10 декабря 2011 г.

Плагин для MaxSite CMS Yahoo! Media Player

Позволяет выводить mp3 в виде flash-плейера.

В тексте указывайте так:

<a href="example1.mp3">My first song</a>


можно добавлять и мувики, например с Тытрубы


<a href="http://www.youtube.com/watch?v=i56XeM0-b8Y">Zoetrope (YouTube link)</a>







Посмотреть, как это выглядит, можно
здесь

скачать плагин

вторник, 25 октября 2011 г.

Парсинг , Граббинг Группы вконтакте

Собрать всех участников ( их ID ) какой-либо группы с сайта vkontakte.ru

для примера возьмем группу "Я ненавижу автомобили"

http://vk.com/search?c[section]=people&c[group]=1409939

function GetAllMembersPage($oid = 1409939, $offset = 0)
 {
  $this-> code = $this-> GetMembersPage($oid, $offset);

  if(preg_match_all ('~

В группе (.*) участников.

~', $this-> code, $m)) { $members_count = strip_tags($m[1][0]); $members_count = (int)str_replace (' ', '', $members_count); echo "нашли В группе $members_count участников"; //print_r($m); } $users_data[] = $this-> GetMembers(); $offset = 20; while ($offset < $members_count) { echo "i=$i "; echo "offset=$offset "; $this-> GetMembersPage($oid, $offset); $users_data[] = $this-> GetMembers(); $offset = $offset +20; } //print_r($users_data); foreach($users_data as $d) { foreach($d[1] as $k=>$v) { $users_data_w1[ $d[1][$k] ] = $d[2][$k]; $users_data_w_id[ $d[1][$k] ] = $d[1][$k]; } } $users_data_w_id = array_unique ($users_data_w_id); $this-> write_string("members_id.txt", '', "w"); foreach($users_data_w_id as $id) { $this-> write_string("members_id.txt", trim($id)."\n", "a"); } } //******************************** //* //* http://vk.com/al_page.php?act=show_members_box&al=1&gid=1409939&tab=members //* http://vk.com/al_page.php?act=show_members_box&al=1&gid=1409939&tab=members&offset=190 //* //******************************* function GetMembersPage($gid = 1409939, $offset=0) { $p = array ( "act" => "show_members_box", "al" => "1", "tab" => "members", "gid" => $gid, "offset" => $offset, ); $post_fields = http_build_query($p); $curl_data['post'] = $post_fields; $curl_data['followlocation'] = true; $curl_data['echo_header'] = true; $curl_data['referer'] = $this->site.""; $curl_data['url'] = $this->site."/al_page.php"; $this->code = $this->curl($curl_data); //print_r($this->code); $this-> write_string("show_members_box_log.htm", $this->code); return $this->code; } function GetMembers() { if(preg_match_all ('~(.*)~U', $this-> code, $m)) { //print_r($m); return $m; } else { return false; } }

На выходе имеем файл "members_id.txt"
вида

/skarrr
/id305045
/deviatio
/id538322
/arrtemy
/lerarunge
/id846721
/id1099400
/stigma
/stanislavre
/id1295336
/id1359451
/id1362725
/id1466790
/cor_serpentis
/id3801455
/id3917827
/id3960713
/jjozhkashut
/id4620731
/id4675099
/id4772386
/id5549687
/id7528496
/nastroy_voice
/slavin.anton
/id8381743
/id8888177
/id8919195
/id9414070
/id12545362
/id12614309
/id13689235
/eugeniy_victorovich
/id15446689
/id15749772
/id17258303
/id19105109
/amerius
/id21486556
/id22178446
/id24001470
/id24663151
/id25468242
/dokkdokk
/x_nemo_x
/id30769974
/pripyat_v_serdce
/id38287278
/id49674719
/yeticlub
/id54853271
/opium83w
/id68409528
/id68413777
/qwertypoint
/id94558605
/id128952800
/id132524251
/id135713564


скачать исходник:
http://rghost.ru/27066891

пасс: parsing-posting.blogspot.com

четверг, 20 октября 2011 г.

php скрипт постинга в Elgg

Неплохой движок. Бесплатный. Русифицирован и создано много сообществ в поддержку и развитие проекта.

Уникальные признаки:

"Powered by Elgg" inurl:"pg/dashboard"
"Powered by Elgg" inurl:"pg/register"

Например, если нам нужны будут блоги для постинга прокладок или доров. Для этого к признаку сразу добавляем Blogs и получаем уже необходимые нам ресурсы с установленным модулем Blogs:

"Powered by Elgg" inurl:"pg/blog"
inurl:"user/auth/forgot" + Blogs


Легкая автоматизация, набиваем посты:

function post()
 {
   $headers = $this->set_headers();
   $curl_data['headers'] =  $headers;
   $curl_data['followlocation'] = true;
   $curl_data['echo_header'] = true;

   $curl_data['url'] = $this->site."/mod/blog/everyone.php";
   $curl_data['referer'] = $this->site.'/pg/dashboard/';

   $this->code = $this->curl($curl_data);

   $curl_data['url'] = $this->site."/pg/blog/".$this->username."/new/";
   $curl_data['referer'] = $this->site."/mod/blog/everyone.php";

   $this->code = $this->curl($curl_data);

   if(strpos($this->code, 'blogPostForm'))
   {

     # выбираем поля для постинга
    $input_field = $this->get_input_field_post();

    if($input_field[__elgg_token] )
    {
     $input_field[submit] = $this->action;

     $input_field[blogtitle] = $this->post_title;
     $input_field[blogbody] = $this->body;
     $input_field[blogtags] = $this->tags;
     $input_field[comments_select] = 'on';
     $input_field[access_id] = 2;

     $p = array 
     (
     '__elgg_token' => $input_field[__elgg_token],
     '__elgg_ts' => $input_field[__elgg_ts],
     'access_id' => '2',
     'comments_select' => 'on',
     'blogtitle' => $this->post_title,
     'blogbody' => $this->body,
     'blogtags' => $this->tags,
     'submit' => $this->action,
     );

     $curl_data['post'] = http_build_query($p);
     $headers = $this->set_headers();
     $headers[] = "Referer: ".$this->site."/pg/blog/".$this->username."/new/";
     $curl_data['headers'] =  $headers;

     $curl_data['followlocation'] = true;
     $curl_data['echo_header'] = true;
     $curl_data['referer'] = $this->site."/pg/blog/".$this->username."/new/";
     $curl_data['url'] = $this->site."/action/blog/add";
     $this->code = $this->curl($curl_data);

     if (stripos($this->code, 'Your blog post was successfully posted')
      or stripos($this->code, '302 Found')
      or stripos($this->code, '302 Moved Temporarily')
      )
     {
       echo "Post Published";
       $this->get_my_blog_post_url();
       return true;
     } else
     {
      echo "Not Allowed, случилась какая-то хуйета";
      return false;
     }
    }
   }
   else
   {
    $curl_data['url'] = $this->site."/pg/pages/new/";
    $curl_data['referer'] = $this->site.'/mod/pages/world.php';

    $this->code = $this->curl($curl_data);

     # выбираем поля для постинга
    $input_field = $this->get_input_field_post();

    if($input_field[__elgg_token] )
    {
     $input_field[submit] = $this->action;

     $input_field[blogtitle] = $this->post_title;
     $input_field[blogbody] = $this->body;
     $input_field[blogtags] = $this->tags;
     $input_field[comments_select] = 'on';
     $input_field[access_id] = 2;

     $p = array (


     '__elgg_token' => $input_field[__elgg_token],
     '__elgg_ts' => $input_field[__elgg_ts],
     'access_id' => '2',
     'comments_select' => 'on',
     'container_guid' => $input_field[container_guid],
     'owner_guid' => $input_field[owner_guid],
     'parent_guid' => $input_field[parent_guid],
     'write_access_id' => '-2',
     'title' => $this->post_title,
     'description' => $this->body,
     'tags' => $this->tags,


     );

     $curl_data['post'] = http_build_query($p);
     $headers = $this->set_headers();
     $headers[] = "Referer: ".$this->site."/pg/pages/new/";
     $curl_data['headers'] =  $headers;

     $curl_data['followlocation'] = true;
     $curl_data['echo_header'] = true;
     $curl_data['referer'] = $this->site."/pg/pages/new/";
     $curl_data['url'] = $this->site."/action/pages/edit";

     $this->code = $this->curl($curl_data);

     if (stripos($this->code, 'Pages saved')
      or stripos($this->code, '302 Found')
      or stripos($this->code, '302 Moved Temporarily')
      )
     {
       echo "Page Published";
       $this->get_my_page_post_url();
       return true;
     } 
     else
     {
      echo "Not Allowed, случилась какая-то хуйета";
      return false;
     }
    }
   }
 }