Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    socket https: invece sembra http

    Ciao a tutti, cerco di collegarmi via socket a una pagina sotto HTTPS , ma sembra che si colleghi sempre con HTTP e non HTTPS, infatti ottengo l'errore

    HTTP/1.1 404 Not Found Date: Fri, 14 Oct 2005 12:23:47 GMT Server: Apache Content-Length: 280 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: text/html; charset=iso-8859-1
    Not Found
    The requested URL /dir/pagina.cgi was not found on this server.

    Apache Server at sito.com Port 80

    Il codice che uso è questo:


    codice:
    $host='sito.com' ;
    $target='/dir/pagina.cgi';
    $port=80 ;
    $timeout=60;
    $protocol="HTTPS/1.0" ;
    $br="\r\n" ;
    $sk=fsockopen($host,$port,$errnum,$errstr,$timeout) ;
    if(!is_resource($sk)){
    exit("Connessione fallita: ".$errnum." ".$errstr) ;
    }
    
    else{
    $headers="GET ".$target." ".$protocol.$br ;
    $headers.='Authorization: Basic '.base64_encode('user:pass').$br;
    $headers.="Accept: image/gif, image/x-xbitmap, image/jpeg".$br ;
    $headers.="Accept-Language: italiano".$br ;
    $headers.="Host: ".$host.$br ;
    $headers.="Connection: Keep-Alive".$br ;
    $headers.="User-Agent: Socket-PHP-browser 1.0".$br;
    $headers.="Referer: http://www.miosito.com".$br.$br ;
    
    
    fputs($sk,$headers) ;
    
    $dati="" ;
    while (!feof($sk)) {
    $dati.= fgets ($sk,2048);
    }
    }
    fclose($sk) ;
    che cosa sbaglio? perchè la connessione via socket non avviene tramite HTTPS? Help!
    www.ilCamelopardo.it
    Soluzioni Internet
    Sicurezza & igiene del lavoro

  2. #2
    Aggiornamento: ho scoperto che il collegamento non va fatto sulla porta 80 ma sulla 443 (in effetti c'era una vocina nel mio cervello che diceva "la porta 80 è per l'http!").
    Comunque adesso, con lo stesso codice di prima ma con la porta modificata, ottengo l'errore:

    Your browser sent a request that this server could not understand.
    Reason: You're speaking plain HTTP to an SSL-enabled server port.
    Instead use the HTTPS scheme to access this URL, please.



    Adesso la mia domanda è: ma come gli devo parlare a sto server?! Ri-help!
    Grazie
    www.ilCamelopardo.it
    Soluzioni Internet
    Sicurezza & igiene del lavoro

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.