Lid |
|
maar in dat stukje staat niets wat betreft inloggedeelte?
Ik ben nu deze tutorial aan het volgen:
http://scriptas...in_44.html
Is wel goed uitgelegd. Maar toch wil het niet werken. Ik denk hierdoor:
Ik moet een bestand cookie.txt hebben, en schrijfrechten geven. Maar aangezien ik op localhost zit op een windows pc, kan ik dat toch niet chmodden?
//EDIT:
hmm krijg de indruk dat de code niet helemaal correct is bij die tutorial. Aan de reacties op dat forum te lezen 
Kzal eens een andere moeten zoeken
//EDIT 2:
Het is me gelukt. Al bij al toch wat sneller dan verwacht 
Hierbij de gebruikte code. Dit is niiiiiiiice.
Nu kan ik eindelijk mijn stats op een wat meer geautomatiseerde manier analyseren e.d.
Echt machtig !
<?php
//stap 1
$LOGINURL = 'http://example.com/loginpagina.php';
$agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$LOGINURL);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
$result = curl_exec ($ch);
curl_close ($ch);
//stap 2
$LOGINURL = 'http://example.com/gewenstepagina.php';
$POSTFIELDS = 'naam=******&paswoord=******';
$reffer = 'http://example.com/loginpagina.php';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$LOGINURL);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$POSTFIELDS);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_REFERER, $reffer);
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
$result = curl_exec ($ch);
curl_close ($ch);
echo $result;
?>
<?php //stap 1 $LOGINURL = 'http://example.com/loginpagina.php'; $agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$LOGINURL); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt"); curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt"); $result = curl_exec ($ch); curl_close ($ch); //stap 2 $LOGINURL = 'http://example.com/gewenstepagina.php'; $POSTFIELDS = 'naam=******&paswoord=******'; $reffer = 'http://example.com/loginpagina.php'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$LOGINURL); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,$POSTFIELDS); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_REFERER, $reffer); curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt"); curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt"); $result = curl_exec ($ch); curl_close ($ch); ?>
|