Помогите исправить ошибку

Discussion in 'PHP' started by DVMade, 26 Feb 2011.

  1. DVMade

    DVMade Banned

    Joined:
    23 Jul 2010
    Messages:
    110
    Likes Received:
    3
    Reputations:
    0
    Писал мне друг скриптик (cUrl) скинул мне его и исчез, в аське не появляется! Скрипт выкидывает ошибку, помогите пожалуйста
    вот код скрипта:
    Code:
    <?
    ini_set('display_errors', 1);
    
    function post_content ($url,$postdata) {
      $uagent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)";
    
      $ch = curl_init( $url );
      curl_setopt($ch, CURLOPT_URL, $url);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($ch, CURLOPT_HEADER, 0);
      curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
      curl_setopt($ch, CURLOPT_ENCODING, "");
      curl_setopt($ch, CURLOPT_USERAGENT, $uagent);
      curl_setopt($ch, CURLOPT_TIMEOUT, 120);
      curl_setopt($ch, CURLOPT_FAILONERROR, 1);
      curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
      curl_setopt($ch, CURLOPT_POST, 1);
      curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
    
    
      $content = curl_exec( $ch );
      $err     = curl_errno( $ch );
      $errmsg  = curl_error( $ch );
      $header  = curl_getinfo( $ch );
      curl_close( $ch );
    
      $header['errno']   = $err;
      $header['errmsg']  = $errmsg;
      $header['content'] = $content;
      return $content;
    }
    
    
    $ip=$_SERVER['REMOTE_ADDR'];
    $url='http://qchat.su:****/';
    $postdata="page=login&ip=%2F$ip&name******&password=******";
    $html=post_content ($url,$postdata);
    
    
    
    $count=preg_match_all('#<a href="(.+?)"><span>(.+?)</span></a>#i', $html, $matches);
    
    $href = htmlspecialchars($matches[1][2]);
    
    $session=substr($href,11,10);
    c("memo1")->text= $session;
    echo $session;
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL, "http://qchat.su:****/?uid=root_$session&page=srvs_stop&ns=glamur");
      curl_setopt($ch, CURLOPT_HEADER, false);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
      curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)');
      $data = curl_exec($ch);
      curl_close($ch);
      ?>
    
    Логины и пароли в целях конфеденциальности заменил "****"

    Текст ошибки при обращении к скрипту:
    Code:
    Notice: Undefined offset: 2 in /***/***/***/****/****/stop.php on line 43  Fatal error: Call to undefined function c() in /***/***/***/***/***/stop.php on line 46
     
    #1 DVMade, 26 Feb 2011
    Last edited: 26 Feb 2011
  2. DVMade

    DVMade Banned

    Joined:
    23 Jul 2010
    Messages:
    110
    Likes Received:
    3
    Reputations:
    0
    Теперь ошибка
    Notice: Undefined offset: 0 stop.php on line 43
     
  3. DVMade

    DVMade Banned

    Joined:
    23 Jul 2010
    Messages:
    110
    Likes Received:
    3
    Reputations:
    0
    http://qchat.su:2222
     
  4. DVMade

    DVMade Banned

    Joined:
    23 Jul 2010
    Messages:
    110
    Likes Received:
    3
    Reputations:
    0
    Такой вопрос - может ли работать curl на портах, например как тут qchat.su:2222
     
  5. SHiNiGaMi

    SHiNiGaMi Banned

    Joined:
    3 Jan 2010
    Messages:
    382
    Likes Received:
    55
    Reputations:
    15
    CURLOPT_PORT
     
  6. Gifts

    Gifts Green member

    Joined:
    25 Apr 2008
    Messages:
    2,494
    Likes Received:
    807
    Reputations:
    614
    DVMade раздел о работе - в другом месте. Здесь этому не место
     
    _________________________