<?php
$username = "";
$password = "";
$url = "https://wordpress.com/wp-login.php";
$cookie = dirname(__FILE__)."/cookie.txt";
$postdata = "log=".$username."&pwd=".$password."&rememberme=forever&wp-submit=Log+In&redirect_to=https%3A%2F%2Fwordpress.com%2F&testcookie=1
";
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
curl_setopt ($ch, CURLOPT_TIMEOUT, 60);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt ($ch, CURLOPT_COOKIEFILE, $cookie);
curl_setopt ($ch, CURLOPT_REFERER, "https://wordpress.com/wp-login.php?redirect_to=https%3A%2F%2Fwordpress.com%2F");
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt ($ch, CURLOPT_POST, 1);
$result = curl_exec ($ch);
if(!$result) {
echo "erro".curl_error($ch);
}
if($result) {
{
curl_setopt($ch, CURLOPT_POST, 1); // change back to GET
curl_setopt($ch, CURLOPT_URL, 'https://wordpress.com/me'); // set url for next request
$exec = curl_exec($ch); // make request to buy on the same handle with the current login session
}
}
curl_close($ch);
unset($ch);
?>
Ich möchte auf eine neue URL umgeleitet werden, nachdem ich mich erfolgreich anmelden Curl-Skript (https://wordpress.com/me). Ich bekomme nichts auf dem Bildschirm, nachdem ich den Code auf einem localhost ausgeführt habe. auch bin ich nicht in der Lage, alles auf dem Browser anzuzeigen, aber die Cookies eingesetzt sind bereits DateiWie Umleiten, nachdem ich mich zu Curl-Skript anmelden