Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it
    Registrato dal
    Oct 2008
    Messaggi
    16

    Problemi fsockopen su sito freesms.net

    Ragazzi, sto sbattendo da un bel pò!
    Non so se è un problema di cache, ma sembra che con la fsockopen il sito freesms.net non voglia colloquiare!

    Se inserisco in una pagina php vuota questo codice:

    codice:
    <?php
    function hostconnect($host, $timeout, $errmsg) {
        $try = 0;
        do {
            $fp = fsockopen($host,80, $errmsg, $errmsg, $timeout);
            $try++;
        } while (!$fp && $try < 2); // Try 2 times to avoid aborting on first
                                    //  connection error 
    
        if(!$fp){
            $risposta = $errmsg;
            termina($risposta);
            return FALSE;
        }
        return $fp;
    }
    
       $address="http://www.freesms.net/";
        $addarray=parse_url($address);
    
        $fp = hostconnect($addarray['host'], 30, "Errore, sito non disponibile");
    
    
        fputs($fp, "GET ".$addarray['path']."?".$addarray['query']." HTTP/1.1\r\n");
        fputs($fp, "Host: ".$addarray['host']."\r\n");
        fputs($fp, "Accept: */*\r\n");
        fputs($fp, "Cache-Control: no-cache\r\n");
        fputs($fp, "Content-Type: application/x-www-form-urlencoded\r\n");
        fputs($fp, "Content-Length: 0 \r\n");
        fputs($fp, "User-agent: Mozilla/4.0 (compatible: MSIE 7.0; Windows NT 6.0)\r\n");
        fputs($fp, "Connection: close\r\n\r\n");
    
        $view="";
        $event="";
        $toolkit="";
        $temp="";
        $header="";
        
        while (!feof($fp))
    	{
            $temp=fgets($fp, 1024);
            $header.=$temp;
            if($tmp=stristr($temp,"__VIEWSTATE&quot; value=&quot;")) $view=substr($tmp, 0, strpos($tmp,"&quot;"));
            if($tmp=stristr($temp,"__EVENTVALIDATION&quot; value=&quot;")) $event=substr($tmp, 0, strpos($tmp,"__EVENTVALIDATION&quot; value=&quot;"));
            if($tmp=stristr($temp,"_TSM_CombinedScripts_=")) $toolkit=trim(substr($tmp, 0, strpos($tmp,"&quot;")));
        }
    
        fclose($fp);
    echo $header;
    ?>
    Il risultato è sempre


    codice:
    HTTP/1.1 302 Found Cache-Control: private Content-Type: text/html; charset=iso-8859-1 Location: /Error.htm?aspxerrorpath=/default.aspx Server: Microsoft-IIS/7.5 X-AspNet-Version: 2.0.50727 X-Powered-By: ASP.NET Date: Fri, 13 May 2011 20:03:55 GMT Connection: close Content-Length: 163
    Object moved to here.
    Non riesco a capire perchè!
    Se al posto di http://www.freesms.net/ ci metto un altro sito qualunque (anke http://www.google.it/) funziona alla perfezione!
    Qualcuno sa come mai con freesms.net non funziona?

  2. #2
    generalmente questo tipo di operazioni vanno autorizzate dai proprietari dei siti perché, generalmente, se ci sono meccanismi per evitare che qualcuno simuli un browser sfruttando i loro servizi, loro non vogliono.

    gentilmente evitiamo questo tipo di questioni

    grazie

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.