Jump to content


Urian

Member Since 28/03/2004
Offline Last Active 08/10/2006, 02:49
-----

Topics I've Started

Impressão De Nota Fiscal

04/04/2004, 18:49

Queria saber qual é o grau de deificuldade de se desenvolver um programa que imprima notas fiscais em impressoras .


se poderem, quero uma prévia.


valeu galera.

Rodar Programas Cgi No Próprio Delphi

04/04/2004, 18:28

Eu uso o Xitami para testar meu programas em cgi, mas queria usar o recurso do Delphi 7 que não precisa de servidor, em que o prório Delphi roda os aplicativos.

Alguém de uma juda.

valeu galera.

Me Espliquem Como Fazer

28/03/2004, 21:07

Alguém pode me dar uma luz de como fazer isto na prática?


Consider the case when you need some information from other website. The simplest way to get it is to write the CGI script that connects to the other website and requests the document by HTTP request. Then you will be able to parse the document and get any information you need. For example currency exchange rate or leatest news from the other website.


The simplest way to do it is to use IO::Socket module. Here is the simple code with comments:

Tells Perl to use module
use IO::Socket;

Host address (or hostname) of website having needed document
my $host="webclass.ru";

Request string of simplest HTTP request to web server on distant host
We should write URL address of requested document here
my $getstring="GET http://webclass.ru/index.php3 HTTP/1.0\n\n";

Creating connection
Port number of web server = 80.
Protocol is tcp.
If connection couldn't be opened the execution dies here.
my $sock = new IO::Socket::INET(PeerAddr => $host, PeerPort => 80, Proto => 'tcp') or die "couldn't connect";

Sending HTTP request string to web server.
print $sock "$getstring";

Read the answer.
my $buf="";
while($line = <$sock>) {
$buf.=$line;
}

Close connection
close($sock);

Now you have requested document in the $buf variable
If you output it:
print $buf;

IPB Skin By Virteq