Flash CS3 - Flash CS4

Free tutorials and scripts for all.
Actionscript 3.0

Controllo $_SERVER[requestmethod] = POST

This is a discussion on Controllo $_SERVER[requestmethod] = POST within the Flash CS3 | PHP | mySQL forums, part of the Flash CS3 generale category; myButton.addEventListener(MouseEvent.CLICK, myButtonFunction); function myButtonFunction(event: MouseEvent):void { var request:URLRequest = new URLRequest("http://localhost/xphil/modnews.php"); ...


Go Back   Forum Flash CS3 Flash CS4 > Flash CS3 e Actionscript 3.0 > Flash CS3 generale > Flash CS3 | PHP | mySQL

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-08-08, 10:03
Junior Member
 
Join Date: Aug 2008
Posts: 3
Rep Power: 0
NikiNiki is on a distinguished road
Controllo $_SERVER[requestmethod] = POST

myButton.addEventListener(MouseEvent.CLICK, myButtonFunction);

function myButtonFunction(event: MouseEvent):void
{
var request:URLRequest = new URLRequest("http://localhost/xphil/modnews.php");
request.method = URLRequestMethod.POST;
navigateToURL(request,"_self");
}

Ho creato un pulsante aggiungendovi questo codice, ma alla pagina modnews, effettuo un controllo $_SERVER['REQUEST_METHOD'] == 'POST'.

Ed ogni volta mi dice che il metodo di richiesta della pagina č GET e non POST.

Aiutatemi!! Non capisco dove sbaglio!

Grazie
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #2 (permalink)  
Old 10-08-08, 17:15
tem's Avatar
tem tem is offline
Moderator
 
Join Date: Jan 1970
Posts: 488
Rep Power: 39
tem is on a distinguished road
Re: Controllo $_SERVER[requestmethod] = POST

Ciao!
per passare i dati in post puoi utilizzare questo metodo.. č tratto da un form mail di Flep:

Code:
private function inviaDati():void
		{
                        //in questo caso inviamo al php delle variabili
			var variables:URLVariables=new URLVariables();
			variables.email=email_txt.text;
			variables.messaggio=message_txt.text;
			variables.titolo=title_txt.text;
			variables.nome=name_txt.text;
			var richiesta:URLRequest=new URLRequest();
			//la nostra richiesta viene fatta a questo file
			richiesta.url='http://www.flepstudio.org/utilita/emailForm/inviaMail.php';
			richiesta.method=URLRequestMethod.POST;
			richiesta.data=variables;
			var loader:URLLoader=new URLLoader();
			loader.dataFormat=URLLoaderDataFormat.VARIABLES;
			addListeners(loader);
			try 
			{
				loader.load(richiesta);
			} 
			catch (error:Error) 
			{
				trace('Unable to load richiestaed document.');
			}
		}
		
		private function addListeners(d:IEventDispatcher):void
		{
			d.addEventListener(Event.OPEN,inizio);
			d.addEventListener(ProgressEvent.PROGRESS,inProgresso);
			d.addEventListener(Event.COMPLETE,completato);
			d.addEventListener(SecurityErrorEvent.SECURITY_ERROR,securityError);
			d.addEventListener(HTTPStatusEvent.HTTP_STATUS,httpStatus);
			d.addEventListener(IOErrorEvent.IO_ERROR,ioError);
		}
		
		private function inizio(e:Event):void 
		{
			debug_txt.text='Invio messaggio in corso...';
		}
		
		private function inProgresso(e:ProgressEvent):void 
		{
			debug_txt.text='Invio messaggio in corso...';
		}
		
                //controllo la risposta dal php
		private function completato(e:Event):void
		{
			var loader:URLLoader=URLLoader(e.target);
			var vars:URLVariables=new URLVariables(loader.data);
                         //qui controllo se ricevo l'echo answer="ok" dal php.
			if(vars.answer=='ok')
				debug_txt.text='The message has been correctly sent';
			else
				debug_txt.text='System error, please try again';
			togliAlert();
		}
		
		private function securityError(e:SecurityErrorEvent):void 
		{
			debug_txt.text='Errore di sistema, ripova per favore';
		}
		
		private function httpStatus(e:HTTPStatusEvent):void {}
		
		private function ioError(e:IOErrorEvent):void 
		{
			debug_txt.text='Errore di sistema, ripova per favore';
		}
spero possa aiutarti..
__________________
http://www.thetconcept.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #3 (permalink)  
Old 10-08-08, 18:05
Junior Member
 
Join Date: Aug 2008
Posts: 3
Rep Power: 0
NikiNiki is on a distinguished road
Re: Controllo $_SERVER[requestmethod] = POST

Il mio problema non č passare dei dati tramite post, ma sono controllare che la richiesta alla pagina avvenga tramite POST, poichč devo eseguire una visualizzazione della stessa in base al fatto che essa venga chiamata tramite POST o tramite GET.

E' solo che se faccio un controllo PHP $_SERVER[REQUEST_METHOD] == 'POST'
lui mi dice che la richiesta č sempre get anche se il pulsante ha
request.method = URLRequestMethod.POST;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #4 (permalink)  
Old 11-08-08, 17:30
tem's Avatar
tem tem is offline
Moderator
 
Join Date: Jan 1970
Posts: 488
Rep Power: 39
tem is on a distinguished road
Re: Controllo $_SERVER[requestmethod] = POST

Ciao!
credo che allora dovresti utilizzare questo metodo: AS3 Posting Variables to a Page | Wookets Wove

Code:
var request:URLRequest = new URLRequest("http://yourserver.com/files/download/");
request.method = URLRequestMethod.POST;
var variables:URLVariables = new URLVariables();
variables.resourceType = "Document";
variables.resourceId = 34bds34pkd;
request.data = variables;
navigateToURL(request, "_blank");
fai una prova inviando delle variabili.. forse nel tuo caso facendo una richiesta post senza inviare variabili veniva interpretato come un get dal php...
__________________
http://www.thetconcept.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #5 (permalink)  
Old 11-08-08, 17:36
Junior Member
 
Join Date: Aug 2008
Posts: 3
Rep Power: 0
NikiNiki is on a distinguished road
Re: Controllo $_SERVER[requestmethod] = POST

Grazie!!
Ora funziona, anche se non capisco perchč uno deve essere costretto a passare delle variabili per utilizzare il metodo post.

Grazie ancora

Ciaoo
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Flash Multi Gallery
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads

Thread Thread Starter Forum Replies Last Post
News con pannello di controllo italobalbo Flash CS3 | PHP | mySQL 3 14-07-08 23:39
Microsoft sta per rimuovere il controllo active X da IE Flep Off Topic - Libera la mente 2 11-04-08 09:14
Funzione controllo usbgeek Flash CS3 generale 2 10-04-08 11:32
controllo audio con javascript antmil CSS | HTML 7 27-11-07 17:20
Controllo Tween e TweenEvent zizzolo Actionscript 3.0 base 1 15-10-07 10:30


All times are GMT. The time now is 18:06.


Powered by vBulletin versione 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC4
Forum SiteMap


FlepStudio
by Filippo Lughi
P.IVA 03605860406