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 08:14:50 +0100 (CET)

On Sun, 27 Nov 2005, StephenB wrote:

> I'm having a number of problems translating an fsockopen call to a remote
> server. The server is a domain availability checker running on port2043 and
> tied to the calling servers IP address.

always always always include libcurl version number and info about that
platform it runs on.

> $dac = fsockopen("dac.nic.uk", 2043, $errno, $errstr, 10);
> if (!$dac) {
> echo "$errstr ($errno)<br />\n";
> exit;
> } else {
> //do stuff
> fputs($dac, "domain.co.uk\r\n");
> $resp = fgets($dac,128);
> }

I don't know much PHP, but this is quite far from a PUT request...

> $ch = curl_init();
> curl_setopt($ch, CURLOPT_URL, 'http://dac.nic.uk');
> curl_setopt($ch, CURLOPT_PORT, 2043);
> curl_setopt($ch, CURLOPT_HEADER, 0);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
> curl_setopt($ch, CURLOPT_TIMEOUT, 5);
> curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
> curl_setopt ($ch, CURLOPT_HTTPHEADER, $curlPost);
> $data = curl_exec($ch);

... and this is a weird way to convert a GET request into a PUT.

Did you try to append the port number in the URL string?

-- 
  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