• Welcome to Simple Machines Community Forum. Please login or sign up.
December 03, 2021, 07:26:58 AM

News:

Join the Facebook Fan Page.


Login con curl

Started by ziopeppe, May 23, 2010, 12:25:57 PM

Previous topic - Next topic

ziopeppe

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

Giochi


Advertisement: