Simple Machines Community Forum

SMF Support => Language Specific Support => Italiano (Italian) => Topic started by: ziopeppe on May 23, 2010, 12:25:57 PM

Title: Login con curl
Post by: ziopeppe on May 23, 2010, 12:25:57 PM
Salve ho l'esigenza di effettuare il login a smf 2.0 attraverso curl con php... ho provato una cosa del genere ma purtroppo non funziona, dove sbaglio?:

<?

  $user = "ilmionome";
  $password = "miapassword";
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_HEADER, true);
  curl_setopt($ch, CURLOPT_VERBOSE, 1);
  curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
  curl_setopt($ch, CURLOPT_TIMEOUT, 10);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  curl_setopt($ch, CURLOPT_COOKIEJAR, $_SERVER['DOCUMENT_ROOT']."/cookie.txt");
  curl_setopt($ch, CURLOPT_URL, "index.php");
  curl_setopt($ch, CURLOPT_POSTFIELDS, "&action=login2&user=$user&passwrd=$password&cookielength=-1&submit=Login");
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  $result = curl_exec($ch);


  curl_setopt($ch, CURLOPT_POSTFIELDS, "message=".urlencode($message)."&subject=$subject&post=Post&notify=0topic=$message_id&action=post2&board=1");

  $result = curl_exec($ch);
  curl_close($ch);
?>

Spero nella risoluzione del problema.. Grazie a tutti
Title: Re: Login con curl
Post by: Giochi on July 27, 2010, 07:07:05 AM
Non so su di esso