Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

...
  • 6 commits
  • 4 files changed
  • 0 commit comments
  • 2 contributors
11 classes/minicurl.class.php
View
@@ -12,6 +12,7 @@ class minicurl
private $user_agent = FALSE;
private $referer = FALSE;
private $postfields = FALSE;
+ private $debug_pages = array();
function __construct($headers, $cookies_file, $user_agent, $proxy = FALSE,
@@ -54,6 +55,11 @@ public function clear_cookies()
$this->cookies = '';
}
+
+ public function debug_pages()
+ {
+ return $self->debug_pages;
+ }
private function cURL_get_file($url)
{
@@ -105,6 +111,11 @@ private function cURL_get_file($url)
$result = curl_exec($ch);
$error = curl_errno($ch);
+
+ if (defined('DEBUG') AND (DEBUG == TRUE))
+ {
+ $self->debug_pages[$url] = $result;
+ }
if ($error != '0') {
// TODO: add exceptions
27 classes/vk_poster.class.php
View
@@ -165,6 +165,11 @@ public function post_to_public_page($page_id, $message)
public function print_last_error()
{
+ if (defined('DEBUG') AND (DEBUG == TRUE))
+ {
+ var_dump($self->minicurl->debug_pages());
+ }
+
$errors = array_reverse(file(LOG_FILE));
return '<b>Error!</b><br>' . $errors[0];
}
@@ -175,7 +180,7 @@ public function print_last_error()
private function need_auth()
{
- $result = $this->minicurl->get_file('http://vkontakte.ru/settings');
+ $result = $this->minicurl->get_file('http://vk.com/settings');
$this->sleep();
return strpos($result, 'HTTP/1.1 302 Found') !==FALSE;
}
@@ -196,14 +201,14 @@ private function auth()
return FALSE;
}
- $this->minicurl->set_cookies('remixsid=' . $sid . '; path=/; domain=.vkontakte.ru');
+ $this->minicurl->set_cookies('remixsid=' . $sid . '; path=/; domain=.vk.com');
return TRUE;
}
private function get_auth_location()
{
- $html = $this->minicurl->get_file('http://vkontakte.ru/');
+ $html = $this->minicurl->get_file('http://vk.com/');
preg_match('#<input type="hidden" name="ip_h" value="([a-z0-9]*?)" \/>#isU', $html, $matches);
$post = array(
@@ -213,13 +218,13 @@ private function get_auth_location()
'captcha_sid' => '',
'email' => $this->email,
'expire' => '',
- 'from_host' => 'vkontakte.ru',
+ 'from_host' => 'vk.com',
'ip_h' => (isset($matches[1]) ? $matches[1]: ''),
'pass' => $this->pwd,
'q' => '1',
);
- $auth = $this->minicurl->get_file('http://login.vk.com/?act=login', $post, 'http://vkontakte.ru/');
+ $auth = $this->minicurl->get_file('http://login.vk.com/?act=login', $post, 'http://vk.com/');
preg_match('#Location\: ([^\r\n]+)#is', $auth, $match);
$this->sleep();
@@ -265,7 +270,7 @@ private function post_to_wall_query($hash, $to_id, $message, $official=FALSE, $f
$photos_attach = $this->load_photos($to_id);
}
- $result = $this->minicurl->get_file('http://vkontakte.ru/al_wall.php', $post);
+ $result = $this->minicurl->get_file('http://vk.com/al_wall.php', $post);
$this->sleep();
preg_match('#>\d<!>\d+<!>([\d]+)<!>#isU', $result, $match);
@@ -275,17 +280,17 @@ private function post_to_wall_query($hash, $to_id, $message, $official=FALSE, $f
private function get_hash($page_id)
{
- $result = $this->minicurl->get_file('http://vkontakte.ru/' . $page_id);
+ $result = $this->minicurl->get_file('http://vk.com/' . $page_id);
$this->sleep();
preg_match('#Location\: ([^\r\n]+)#is', $result, $match);
if (isset($match[1]) AND !empty($match[1]))
{
- $result = $this->minicurl->get_file('http://vkontakte.ru' . $match[1]);
+ $result = $this->minicurl->get_file('http://vk.com' . $match[1]);
$this->sleep();
unset($match);
- preg_match("#act: '([^']+)', code: ge\('code'\)\.value, to: '([^']+)', al_page: '([^']+)', hash: '([^']+)'#is", $result, $match);
+ preg_match("#act: '([^']+)', code: ge\('code'\)\.value, to: '([^']+)', al_page: '([^']*)', hash: '([^']+)'#i", $result, $match);
$post = array(
'act' => $match[1],
@@ -296,7 +301,7 @@ private function get_hash($page_id)
'to' => $match[2]
);
- $result = $this->minicurl->get_file('http://vkontakte.ru/login.php', $post);
+ $result = $this->minicurl->get_file('http://vk.com/login.php', $post);
$this->sleep();
unset($match);
@@ -304,7 +309,7 @@ private function get_hash($page_id)
if (isset($match[1]) AND !empty($match[1]))
{
- $result = $this->minicurl->get_file('http://vkontakte.ru/' . $match[1]);
+ $result = $this->minicurl->get_file('http://vk.com/' . $match[1]);
$this->sleep();
unset($match);
}
1  config.php
View
@@ -7,6 +7,7 @@
// Other config
define('SLEEPTIME', 2); // in seconds; +rand(1, 4) if this var != 0
+define('DEBUG', FALSE); // debug pages
// Files config
define('DATA_DIR', SCR_DIR . '/data');
5 example.php
View
@@ -39,7 +39,10 @@
}
// сообщение для публикации (обязательно в UTF-8)
-$message = 'тестирование; testing';
+$message = array('Ребята, вы такие клёвые!', 'Шексна RIDE рулит!',
+ 'Мутите давайте видос!', 'Дениска,поставь корк уже!',
+ 'Фотки классные у вас!', 'Хочу покатать к вам!');
+$message = $message[array_rand($message)];
// публикация сообщения на странице юзера контакта
if ($vk->post_to_user(137527963, $message))

No commit comments for this range

Something went wrong with that request. Please try again.