I need to write a "listener" script which will accept a POST message at my URL and then reply with a message my script will compose, POSTed to the sender's URL.
An example given shows opening a socket, creating headers and then adding the rest of my composed reply message.
I have located a few examples (one from the IO::Socket::SSL documentation, and a couple more from "Learning Perl"). None of them will successfully open the socket.
This is from the synopsis of the IO::Socket::SSL docs:
my $client = IO::Socket::SSL->new("www.example.com:https")
|| warn "I encountered a problem: ".IO::Socket::SSL::errstr();
$client->verify_hostname( 'www.example.com','http' )
|| die "hostname verification failed";
print $client "GET / HTTP/1.0\r\n\r\n";
I always get the "I encountered a problem" warning, which looks like the following:
I encountered a problem: IO::Socket::INET configuration failederror:00000000:lib(0):func(0):reason(0) at socket_test.cgi line 40.
Trying the examples from the Llama Book* ("Learning Perl" by Schwartz and Christiansen) fails similarly, and it doesn't matter whether I try localhost, or some known website, including the one to which I'm supposed address the listener routine.
*Well, I think it looks like a llama, but I have trouble telling them from an alpaca unless they are side-by-side...