Dat kun je met cURL doen. Ik wilde hier toevallig net een tutorial over gaan schrijven. Morgen rond 12 uur post ik 'm op http://blog.beijers.eu . Maar alvast een stukje code om je misschien al op weg te helpen:
<?php
$url = "http://site.com/login.php";
$ch = curl_init();//Initialise CURL
curl_setopt($ch, CURLOPT_URL, $url);//Set the url
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);//We want the data to return
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 10);//Of course, we don't want your script to run forever, so set a timeout
curl_setopt($ch, CURLOPT_POST, true);//We want to request the page by post
curl_setopt($ch, CURLOPT_POSTFIELDS, "login=foo&password=bar");//Post the fields
$text = curl_exec($ch);//Execute and get the page
echo $text;
?>
Let wel op dat je dit niet gaat misbruiken, dan wordt je vast en zeker geblocked op die site.
Het lukt mij niet. ik weet niet wat ik fout doe. ik heb het als volgt.
<?php
$url = "http://www.one2xs.com/klik?user=694&id=213";
$ch = curl_init();//Initialise CURL
curl_setopt($ch, CURLOPT_URL, $url);//Set the url
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);//We want the data to return
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 10);//Of course, we don't want your script to run forever, so set a timeout
curl_setopt($ch, CURLOPT_POST, true);//We want to request the page by post
curl_setopt($ch, CURLOPT_POSTFIELDS, "action=klik?id=208&user=3588");//Post the fields
$text = curl_exec($ch);//Execute and get the page
Maar als ik kijk of de klik er is bij geteld is de kliker niet bij geteld
Er zit beveiliging op, maar probeer dit eens(snel in elkaar geflanst, let niet op de netheid van de code):
<?php
$url = "http://www.one2xs.com/klik?user=694&id=213";
$ch = curl_init();//Initialise CURL
curl_setopt($ch, CURLOPT_URL, $url);//Set the url
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);//We want the data to return
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 10);//Of course, we don't want your script to run forever, so set a timeout
$result = curl_exec($ch);
curl_close($ch);
$exploded = explode('<input type="hidden" name="q" value="',$result);
$exploded = explode('"',$exploded[1]);
$q = $exploded[0];
$ch = curl_init();//Initialise CURL
curl_setopt($ch, CURLOPT_URL, $url);//Set the url
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);//We want the data to return
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 10);//Of course, we don't want your script to run forever, so set a timeout
curl_setopt($ch, CURLOPT_POST, true);//We want to request the page by post
curl_setopt($ch, CURLOPT_POSTFIELDS, "q=".$q);//Post the fields
$text = curl_exec($ch);//Execute and get the page
?>
Als je de source code van die pagina die je wilt oproepen bekijkt zie je dat ze een verborgen input veld hebben genaamd q met een unieke code erin. Deze code pakt dit script eerst en vervolgens post ie het.