Warning: Cannot use a scalar value as an array in /home/admin/public_html/forum/include/fm.class.php on line 757

Warning: Invalid argument supplied for foreach() in /home/admin/public_html/forum/include/fm.class.php on line 770
Форумы портала PHP.SU :: Версия для печати :: Не работает авторизация cURL
Форумы портала PHP.SU » » Вопросы новичков » Не работает авторизация cURL

Страниц (1): [1]
 

1. android - 03 Декабря, 2011 - 23:15:28 - перейти к сообщению
Привет, пытаюсь авторизоватся на сайте а скрипт не работает...

Любой сайт UCOZ без капчи в форме входа.

PHP:
скопировать код в буфер обмена
  1.  
  2. $site='http://ucoztalk.ru/';
  3.  
  4. function curl($url, $post = '', $binary = 0 ){
  5.   $ch = curl_init();
  6.   curl_setopt($ch, CURLOPT_URL, $url);
  7.   if($binary == 0){
  8.     curl_setopt($ch, CURLOPT_HEADER, 1);
  9.   }else{
  10.     curl_setopt($ch, CURLOPT_HEADER, 0);
  11.   }
  12.   curl_setopt($ch, CURLOPT_USERAGENT, "User-Agent: Opera/9.25 (Windows NT 6.0; U; ru)");
  13.   curl_setopt($ch, CURLOPT_NOBODY, 0);
  14.   if(!empty($post)){
  15.     curl_setopt($ch, CURLOPT_POST, 1);
  16.     curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
  17.   }
  18.   curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt"); // Записываем куки
  19.   curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt"); // Считаем куки
  20.   curl_setopt($ch, CURLOPT_BINARYTRANSFER, $binary);
  21.   curl_setopt($ch, CURLOPT_TIMEOUT, 60);
  22.   curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
  23.   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  24.   $result = curl_exec($ch);
  25.   curl_close($ch);
  26.   return $result;
  27. }
  28.  
  29. curl($site.'/index/sub/','user='.$login.'&pass='.$pass.'&rem=1&hidden=1&a=2&ajax=2');
  30.  
2. EuGen - 03 Декабря, 2011 - 23:51:29 - перейти к сообщению
Отладку делали?

http://phpfaq[dot]ru/debug
3. android - 03 Декабря, 2011 - 23:58:51 - перейти к сообщению
да, ошибок не найдено

 

Powered by ExBB FM 1.0 RC1