cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: fsockopen replacment

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 28 Nov 2005 12:38:01 +0100 (CET)

On Mon, 28 Nov 2005, StephenB wrote:

> Mark/Daniel. Treat a novice kindly. Curl looks fun, but usage documentation
> is sparce.

Well, since PHP/CURL is just a binding for libcurl, you can read and use lots
of docs for curl and libcurl as it mostly applies to PHP/CURL as well.

But I agree that the PHP/CURL docs situation has lots of room for
improvements.

> The server response through telnet is:
> [~]# telnet dac.nic.uk 2043
> Trying 195.66.240.114...
> Connected to dac.nic.uk.
> Escape character is '^]'.
> domain.co.uk
> domain.co.uk,Y,N,N,2003-07-29,2007-07-29,2
> garbage
> garbage,I
> ^]
> telnet> quit
> Connection closed.

This is clearly quite far away from HTTP and so all attempts to use PHP/CURL
for this will most likely fail.

(And I won't even try to get the telnet:// support of libcurl described, as I
have no reason to believe it works any good with PHP/CURL...)

> It appears that the connection is taking each line of the headers as a
> request. I'm not sure if there's a way around this.

It sends a HTTP request and expects a HTTP response. That server doesn't want
a HTTP request and it doesn't provide a HTTP response.

> Any suggestions on using telnet through curl would be appreciated.

$ curl telnet://host.domain.com/

But the telnet support in curl/libcurl is lacking, and I'm not sure you'll be
able to do what you want with it.

IMHO, you should use 'netcat'.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2005-11-28