|
|
|
![]() |
|
Strumenti |
![]() |
#1 |
Senior Member
Iscritto dal: Apr 2001
Città: Milano
Messaggi: 3736
|
[c/c++] leggere un testo via http
il titolo non è sicuramente molto chiaro ma di meglio non mi veniva in mente
![]() Ho un programma che resta in ascolto su una determinata porta, quando mi connetto con un browser, quello che viene mostrato sono le seguenti rughe del protocollo HTTP: Codice:
POST / HTTP/1.1 Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */* Accept-Language: it User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C) Content-Type: application/x-www-form-urlencoded Accept-Encoding: gzip, deflate Host: localhost:2800 Content-Length: 0 Connection: Keep-Alive Cache-Control: no-cache Codice:
<html> <head> <title>My Page</title> </head> <body> <form name="myform" action="http://localhost:5002" method="POST"> <div align="center"> <br><br> <input type="text" size="50" value="testo da catturare"> <br><input type="submit" value="loadpp"><br> </div> </form> </body> </html> grazie 1000 |
![]() |
![]() |
![]() |
#2 |
Senior Member
Iscritto dal: Apr 2001
Città: Milano
Messaggi: 3736
|
quello che mi servirebbe credo sia una cosa del genere per pyton ma in C
Codice:
#!/usr/bin/env python import html import cgi import cgitb; cgitb.enable() # for troubleshooting print("Content-Type: text/html") # HTTP header to say HTML is following print() # blank line, end of headers form = cgi.FieldStorage() say = html.escape(form["say"].value); to = html.escape(form["to"].value); print(say, " ", to) https://developer.mozilla.org/en-US/...ving_form_data |
![]() |
![]() |
![]() |
#3 |
Bannato
Iscritto dal: Mar 2008
Città: Villabate(PA)
Messaggi: 2515
|
|
![]() |
![]() |
![]() |
#4 |
Senior Member
Iscritto dal: Apr 2001
Città: Milano
Messaggi: 3736
|
grazie per i link ma ho risolto con un componente di bcb
|
![]() |
![]() |
![]() |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 11:59.