hallo,
ich versuche mit curl ein post formular (externer host) auszufüllen und per submit-button zu senden.
leider klappt das aber nicht ganz.
kann mir jemand vielleicht sagen was ich falsch mache?
also das formular wäre folgendes:
PHP-Code:
<form action='modules.php?name=Your_Account' method='post'>
<input type='text' name='username' size='30' maxlength='15'><br>
<input type='password' name='user_password' size='11' maxlength='15'><br>
<input type='hidden' name='op' value='new_confirm'><br>
<input type='submit' value='User Einloggen'>
</form>
die verwendete url:
$url = "http://www.domain.de/modules.php?name=Your_Account";
CURLOPT_POSTFIELDS values:
PHP-Code:
$fieldsAndValues = "username=myUser&user_password=myPwrd&op=new_confirm&submit=User%20Einloggen";
hier meine curl funktion:
PHP-Code:
function PostForm ($url, $fieldsAndValues)
{
$this->SetDefaults();
$this->url = $url;
$this->cookie = "output/cookie.txt";
$ch = curl_init();
curl_setopt( $ch, CURLOPT_VERBOSE, 1);
curl_setopt( $ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
curl_setopt ($ch, CURLOPT_PROXY, $this->proxy);
curl_setopt ($ch, CURLOPT_TIMEOUT, $this->timeout);
curl_setopt ($ch, CURLOPT_USERAGENT, $this->userAgent);
curl_setopt($ch, CURLOPT_URL,$this->url);
curl_setopt($ch, CURLOPT_COOKIEJAR, $this->cookie);
curl_setopt($ch, CURLOPT_COOKIEFILE, $this->cookie);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fieldsAndValues);
$this->returnData = curl_exec ($ch);
curl_close ($ch);
return $this->returnData;
}
wenn ich $this->returnData ausgebe, bekomme ich wieder die Seite von $url zu sehn.
bitte helft mir... bin schon fast am verzweifeln
danke und gruß
GS