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

    socket e post - perchè non da segni di vita?

    Voglio fare uno script per inviare SMS tramite www.190.it. La prima fase è quella del login, ma quando mando in esecuzione lo script, IE mi resta su "Apertura pagina in corso...", Opera su "Sending request to server..." (localhost... dove stanno gli script).

    Ho seguito le istruzioni sulla guida di freephp.html.it per impostare gli headers, sono nuovo dei socket, quindi l'errore potrebbe essere banale... spero...

    Lo script:

    Codice PHP:
    $host "www.190.it"
    $target "/190/trilogy/jsp/login.do"
    $port 80
    $timeout 60

    $sk fsockopen($host,$port,$errnum,$errstr,$timeout) ; 

    if(!
    is_resource($sk))

        exit(
    "Connessione fallita: ".$errnum." ".$errstr) ; 

    else
    {
        
    $postdata "username=mio&password=prova";

        
    $br "\n";

        
    $headers="POST $target HTTP/1.1$br";
        
    $headers.="Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*$br"
        
    $headers.="Accept-Encoding: gzip, deflate$br"
        
    $headers.="Accept-Language: it$br"
        
    $headers.="Connection: Keep-Alive$br"
        
    $headers.="Content-Length: ".strlen($postdata).$br
        
    $headers.="Content-Type: application/x-www-form-urlencoded$br"
        
    $headers.="Host: $host$br"
         
    $headers.="Referer: http://www.190.it/190/trilogy/jsp/homePage.do";
         
    $headers.="?tk=9616%2ct&tabName=HOME+190&ty_skip_md=true$br";
        
    $headers.="User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)$br$br"
        
    $headers.="{$postadata}$br"

        
    fputs($sk$headers); 

        
    $dati ""

        while(!
    feof($sk))
        { 
            
    $dati.= fgets ($sk,2048);
        } 


    fclose($sk); 

    echo(
    $dati); 
    Grazie in anticpio per ogni suggerimento.
    Concentrate on what cannot lie... The evidence. -- Gil Grissom

  2. #2
    *bump*, sorry.

    Stessa storia anche senza l'ultimo $br
    Concentrate on what cannot lie... The evidence. -- Gil Grissom

  3. #3
    Vabbè, alla fine qualche segno di vita l'ha dato. Ricevo questa risposta ma non so come interpretarla e cosa farci... devo aprire la Location con GET?

    codice:
    HTTP/1.1 302 Found
    Date: Sat, 24 Jul 2004 12:52:51 GMT
    Server: Apache/2.0.39 (Unix) DAV/2
    Set-Cookie: SITESERVER=ID=50B750FB0A0168440003DFF63AC7E6BE; path=/; expires=Tue, 22-Jul-14 12:52:51 GMT; domain=.190.it
    Pragma: no-cache
    Location: http://exch.vodafone.it/CommonAuth/M...do?method=auth
    Cache-Control: no-cache, no-cache, private
    Cache-Control: private
    Expires: -1
    Set-Cookie: BV_IDS=ccdhadcmdfieidjcefeceefdgfmdfnf.0:@@@@12491  25483.1090673571@@@@;Domain=.190.it;Path=/
    Content-Encoding: gzip
    Vary: Accept-Encoding,User-Agent
    Content-Length: 20
    Keep-Alive: timeout=20, max=100
    Connection: Keep-Alive
    Content-Type: text/html; charset=ISO-8859-1
    Aiuto...

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 © 2025 vBulletin Solutions, Inc. All rights reserved.