Newsgroup: it.comp.lang.delphi
Titolo: HTTP e parametri passati via URL

salve, ho una pagina php interfacciata da un mio programma delphi, a questa
pagina passo dei parametri in questo modo:
http://miapagina.php?par=xxxx&par2=xxx
 ecc.
cè un limite massimo di lunghezza per l'url?? se dovessi passare dei blocchi
di testo (tipo memo) ho delle limitazioni??? voi cosa consigliereste??
Simo

"Simone P." nel precedente post ha scritto:

mi sa che sei un attimino OT
prova a fare una pagina locale con un form riempito con i valori
che vuoi passare alla pagina OnLine
poi invialo in post, mettendo nella action del form
http://miapagina.php
, e non hai limiti.
In get (cioè nella querystring legata al nome della pagina)
corri il rischio che valori lunghi siano tagliati via
non mi ricordo il limite di caratteril,
dipende dal Protocollo Http quanto può essere lungo
etc ... studiati un pò le specifiche del protocollo http
e vedi un pò ... o prova su NGs di php o html
comunque con il form di appoggio
ti togli ogni dubbio.
	Ciao
	MassimoB
 

 e vedi un pň ... o prova su NGs di php o html


blocchi
allora ... per ora ti posso postare queste info
non sono utilissime ai fini di Indy ma spiegano 
il limite di passare le variabili in Url
[Estratto da 
http://www.htmlhelp.org/faq/cgifaq.2.html#9
]
---------------------------------------------------------------------
2.9: What is the difference between GET and POST?
Firstly, the the HTTP protocol specifies differing usages for the two
methods.   GET requests should always be idempotent on the server.
This means that whereas one GET request might (rarely) change some state
on the Server, two or more identical requests will have no further effect.
This is a theoretical point which is also good advice in practice.
If a user hits "reload" on his/her browser, an identical request will be
sent to the server, potentially resulting in two identical database or
guestbook entries, counter increments, etc.   Browsers may reload a
GET URL automatically, particularly if cacheing is disabled (as is usually
the case with CGI output), but will typically prompt the user before
re-submitting a POST request.   This means you're far less likely to get
inadvertently-repeated entries from POST.
GET is (in theory) the preferred method for idempotent operations, such
as querying a database, though it matters little if you're using a form.
There is a further practical constraint that many systems have builtin
limits to the length of a GET request they can handle: when the total size
of a request (URL+params) approaches or exceeds 1Kb, you are well-advised
to use POST in any case.
In terms of mechanics, they differ in how parameters are passed to the
CGI script.   In the case of a POST request, form data is passed on
STDIN, so the script should read from there (the number of bytes to be
read is given by the Content-length header).   In the case of GET, the
data is passed in the environment variable QUERY_STRING.   The content-type
(application/x-www-form-urlencoded) is identical for GET and POST requests.
-----------------------------------------------------------------------------------------------------
comunque le mie ricerche continuano ;P
	Ciao
	MassimoB
 

componente INDY http???
cia siamo quasi ...
qui puoi trovare informazioni piů utili 
per una chiamata http corretta ...
comunque ancora niente codice per indy :(
[estratto da 
http://www.ku.edu/~acs/docs/other/forms-intro.shtml
]
-----------------------------------------------------------
What a Post Query Looks Like
When the form is "submitted" as filled out above, the following information is sent to 
www.ku.edu
 by the client: 
POST /cgi-bin/post-query HTTP/1.0
Accept: www/source
Accept: text/html
Accept: video/mpeg
Accept: image/jpeg
Accept: image/x-tiff
Accept: image/x-rgb
Accept: image/x-xbm
Accept: image/gif
Accept: application/postscript
User-Agent:  Lynx/2.2  libwww/2.14
From:  
gr...@www.ku.edu
Content-type: application/x-www-form-urlencoded
Content-length: 150
     * a blank line *
org=Academic%20Computing%20Services
&users=10000
&browsers=lynx
&browsers=cello
&browsers=mosaic
&others=MacMosaic%2C%20WinMosaic
&contact=
Michael%20Grobe%20g...@kuhub.cc.ku.edu
This query is a "POST" query addressed for the program 
residing in the file at "/cgi-bin/post-query". Post-query is a 
script that simply echoes the values it receives. 
Once again the client lists the MIME-types it is capable of accepting,
 and identifies itself and the version of the WWW library it is using. 
Finally, it indicates the MIME-type it has used to encode 
the data it is sending, the number of character included, 
and the list of variables and their values it has collected from the user.
 The MIME-type application/x-www-form-urlencoded means that the 
variable name-value pairs will be encoded the same way a URL is encoded. 
In particular, any special characters, including puctuation characters, 
will be encoded as %nnwhere nnis the ASCII value for 
the character in hexidecimal. 
---------------------------------------------------------------------------
domani spero di poterti dire
qualcosa di piů su indy
	Ciao
	MassimoB
 

componente INDY http???
eccoci a delphi ...
ma non ancora indy ... anche se credo che il passo 
sarà molto breve
[tratto da ]
--------------------------------------------------------------
#139: TWebBrowser and POST request
Today I want to describe how you can send some data to web-server from your remote script using TWebBrowser component.
var
  strData: string;
  PostData: OleVariant;
  Headers: OleVariant;
  i: Integer;
begin
  {1. you must create a string with parameter names and values
  Result string must be in the next format:
  Param1=Value1&Param2=Value2&Param3=Value3...}
  strData := 'Param1Name=' + HTTPEncode(Param1Value) + '&' +
    'Param2Name=' + HttpEncode(Param2Value) + ...;
  {2. you must convert a string into variant array of bytes and
   every character from string is a value in array}
  PostData := VarArrayCreate([0, Length(strData) - 1], varByte);
  { copy the ordinal value of the character into the PostData array}
  for i := 1 to Length(strData) do
    PostData[i-1] := Ord(strData[i]);
  {3. prepare headers which will be sent to remote web-server}
  Headers := 'Content-Type: application/x-www-form-urlencoded' + #10#13;
  {4. you must navigate to the URL with your script and send as parameters
  your array with POST-data and headers}
 
  yourWebBrowserComponent.Navigate('
http://www.yourdomain.com/your_post_script.asp
', EmptyParam, EmptyParam, PostData, Headers);
end;
Of course, the same task can be solved with any internet component which
 implement the http-client (not only TWebBrowser). 
But for every component the data for script will be posted by own rules (most components have pre-defined properties for this task).
For example, you can use my TSMIHTTPClient component from SMInternet suite. 
There you must set Action=haPost and fill the Headers property with own Post-data.
------------------------------------------------------------------------------------------------
vabbè ... basta con i post
 se ti interessa ancora, magari mi posti
altri problemi trovati o le soluzioni che hai dato ...
da creatore di ecommerce ;) 
mi interessa l'argomento ;P
	Ciao
	MassimoB
 

componente INDY http???
eccosi ad indy
[estratto da 
http://www.absolute-research.com/web/Indy/IndySSL/IndySSL.htm
]
---------------------------------------------------
i) Now drop another button on the form.
a. Change it’s caption to be “USE POST”
b. Double click the button to auto-create the onClick event.
c. Put the code highlighted in light blue into the method (Cut and paste it)
procedure TForm1.Button2Click(Sender: TObject);
var
PostDataStream : TStringStream;
ParamData : TStringStream;
begin
PostDataStream := TStringStream.Create('');
ParamData := TStringStream.Create('');
ParamData.WriteString('.src=my');
ParamData.WriteString('&.v=0');
ParamData.WriteString('&.u=a0gonnoue2jjn');
ParamData.WriteString('&.last=');
ParamData.WriteString('&promo=');
ParamData.WriteString('&.intl=us');
ParamData.WriteString('&.bypass=');
ParamData.WriteString('&.partner=');
ParamData.WriteString('&.done=http%3a//
my.yahoo.com
'); 
try
//Connect
IdHTTP1.Post('
https://login.yahoo.com/config/login?
', ParamData, PostDataStream);
Memo1.Text := PostDataStream.DataString;
finally
ParamData.Free;
PostDataStream.Free;
end;
end;
That should do it. The obvious difference between the GET and the POST is that GET 
uses the Querystring and POST allows you to post the data via a sequential list of request data. 
The Querystring I am showing was pulled directly from the URL entry in Internet Explorer so 
I am not stealing any proprietary data here. Just run it and the memo should automatically populate 
with the HTML from the secure login screen from yahoo’s website. 
If this example does not work, simply try a different HTTPS website and parse 
out it’s request data and force feed it back to the website. 
Your client will now be acting as a browser, so be very careful what you do; 
smart admins can track all sorts of interesting information about your connection
 type and you don’t want to call attention to yourself. This tutorial was created to
 help you develop a browser like application that can handle POST/GET and SSL
 all at the same time. 
Have fun!
--------------------------------------------------------------
buon lavoro ;)
	Ciao
	MassimoB
 

 ha scritto nel messaggio
news:BWbta.90881$DT4.2...@twister1.libero.it...
