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

    Conversione script python -> php

    Dovrei convertire un piccolissimo script in Python,
    nel linguaggio php accettato senza problemi dal mio server....
    Solo che non so come eseguirne la conversione....

    Grazie in anticipo per tutti quelli che collaboreranno..
    Inserisco a scopo illustrativo tutta la sezione....


    <html>
    <body>
    ...

    <object classid="..." codebase="..." width="300" height="40">
    <param name="src" value="flash_movies_visible_example.swf">
    <embed src="flash_movies_visible_example.swf" pluginspage="..." width="300" height="40">
    </embed>
    </object>




    ...
    </body>
    </html>


    The script test.py (Python script) gets the path of the shockwave files and calls swf2html - but only, if a search engine (Google) requested the page.

    #!/usr/bin/python

    import os
    import string
    import sys

    if len( sys.argv ) == 2:
    try:
    agent = string.lower( os.environ['HTTP_USER_AGENT'] )

    if string.find( agent, 'google' ) >= 0:
    os.system( '/usr/local/bin/swf2html ' + sys.argv[1] )

    except: pass

  2. #2
    Utente di HTML.it L'avatar di Pasco
    Registrato dal
    Apr 2002
    Messaggi
    1,559
    ciao, potresti provare questo equivalente php , come CGI ovviamente...

    file test.cgi

    codice:
    #! /usr/bin/env php
    <?
    
    print "Content-type: text/html\r\n\r\n";
    
    if( $_SERVER['argc'] == 2 ):
    
    	$agent = strToLower($_SERVER['HTTP_USER_AGENT']);
    
    	if( preg_match("/google/i",$agent) ) :
    	
    		system('/usr/local/bin/swf2html ' . $_SERVER['argv'][1] );
    			
    	endif;
    
    endif;
    
    ?>
    Bye
    PyFanatics

  3. #3
    Utente di HTML.it L'avatar di MMarzia
    Registrato dal
    Mar 2001
    Messaggi
    1,781
    il crossposting č vietato dal regolamento
    io sono festosamente cicciottello :: e. cartman

    t'amo senza sapere come, nč quando nč da dove,
    t'amo direttamente senza problemi nč orgoglio:
    cosė ti amo perchč non so amare altrimenti

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.