• User Attivo

    Navigare sito con cURL, mi restituisce errore

    Buongiorno!
    Vorrei navigare su Facebook senza aprire un Browser, cioè:
    lanciando uno script php tramite curl vorrei fare l'autenticazione e poi andare su altre pagine.

    Ho trovato questo esempio per il "Primo Step" cioè l'autenticazione:

    
    $fields = array(
                    'email' => '---email-fb---',
                    'pass'  => '---password-fb---'
                    );
    
    $cookies = 'cookies.txt';
    
    $ch = curl_init();
    
    curl_setopt($ch, CURLOPT_URL, 'https://m.facebook.com/login');
    curl_setopt($ch, CURLOPT_HEADER, true);
    curl_setopt($ch, CURLOPT_USERAGENT, 'MozillaXYZ/1.0 Finto User-Agent');
    curl_setopt($ch, CURLOPT_COOKIEJAR, $cookies);
    curl_setopt($ch, CURLOPT_COOKIEFILE, $cookies);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    
    $output = curl_exec($ch);
    
    curl_close($ch);
    
    echo $output;
    
    

    ma restituisce questo errore:

    
    HTTP/2 302 pragma: no-cache location: https://m.facebook.com/checkpoint/?checkpoint_data=%7B%22u%22%3A100027601590243%2C%22t%22%3A1607594565%2C%22step%22%3A0%2C%22n%22%3A%224Pu9JWhqzNo%3D%22%2C%22inst%22%3A714186469511400%2C%22f%22%3A207799259245384%2C%22st%22%3A%22p%22%2C%22aid%22%3Anull%2C%22ca%22%3Anull%2C%22la%22%3A%22%22%2C%22ta%22%3A%221607594568.ch.s%3Apw.tDBEAiBEi0AM7VM7jTQ_g5v20Fo3VwS7PYHetaWOSC68QbR71wIgeERxwNuDfxU_xLUaYPnhqfPr8gzv7w1IGREOsM9qVWM%22%2C%22sat%22%3Anull%2C%22s%22%3A%22AWV8DrJ4ZuVenjKFXiU%22%2C%22cs%22%3A%5B%5D%2C%22lds%22%3Atrue%7D&_rdr cache-control: private, no-cache, no-store, must-revalidate expires: Sat, 01 Jan 2000 00:00:00 GMT set-cookie: locale=it_IT; expires=Thu, 17-Dec-2020 10:02:45 GMT; Max-Age=604800; path=/; domain=.facebook.com; secure strict-transport-security: max-age=15552000; preload; includeSubDomains x-content-type-options: nosniff content-type: text/html; charset=utf-8 x-xss-protection: 0 x-frame-options: DENY x-fb-debug: ECJt6w+a27vxNBskmhhsAliDr3Q9Wq9fVeo6XH9fDsJy5MpS2/ERQUnw3ZGvRRXrOU0bb/8PH7Ddui0CcmEApw== content-length: 0 date: Thu, 10 Dec 2020 10:02:48 GMT alt-svc: h3-29=":443"; ma=3600,h3-27=":443"; ma=3600
    
    

    Avete un idea del motivo?