Ik gebruik normaal het volgende, Het werkt wel helaas niet voor alle websites.
Ik gok dat je het allow redirection gedeelte nodig hebt.
<?php
/*--------------------------------------------------------------------------------------------------------------------------
(§) Settings | Login.
--------------------------------------------------------------------------------------------------------------------------*/
#| Username.
$username = '';
#| Login password.
$password = '';
#| Url.
$login_url = '';
/*--------------------------------------------------------------------------------------------------------------------------
(§) cURL | Initialize cURL session.
--------------------------------------------------------------------------------------------------------------------------*/
#| Initialize cURL session
$cURL = curl_init();
/*--------------------------------------------------------------------------------------------------------------------------
(§) cURL | Default cURL settings.
--------------------------------------------------------------------------------------------------------------------------*/
#| Set cURL to return data.
curl_setopt ($cURL, CURLOPT_RETURNTRANSFER, 1);
/*--------------------------------------------------------------------------------------------------------------------------
(§) cURL | Login.
--------------------------------------------------------------------------------------------------------------------------*/
#| Allow redirection.
curl_setopt($cURL, CURLOPT_FOLLOWLOCATION, 1);
#| Set COOKIE.
curl_setopt($cURL, CURLOPT_COOKIEJAR, 'cookie.txt');
#| Set login url.
curl_setopt($cURL, CURLOPT_URL, $login_url);
#| Set it to post data
curl_setopt($cURL, CURLOPT_POST, 1);
#| Set POST data.
curl_setopt($cURL, CURLOPT_POSTFIELDS, 'username='.$username.'&password='.$password);
#| Execute login.
$result = curl_exec($cURL);
/*--------------------------------------------------------------------------------------------------------------------------
(§) cURL | Close cURL session.
--------------------------------------------------------------------------------------------------------------------------*/
#| Close cURL session.
curl_close($cURL);
?>
Link gekopieerd
Object Moved
This object may be found here.
Helaas, nog niet gelukt...
Iemand nog ideeën?
Het gaat overigens om
orkp.avans.nl
Link gekopieerd
Hoe ziet je code er op het moment uit?
Link gekopieerd