curl-and-php
How i can use curl option instead php fputs function?
Date: Mon, 10 Mar 2003 07:14:21 +0300
Hi all,
My hoster just disallow socket operation by fsocketopen and etc. Early i use
script which use above function for connection to some servers API. Part of
code is here:
$fp = fsockopen(server, port, $errno, $errstr, 90);
fputs($fp, $xml);
while(1)
{
$line = fgets($fp);
$result .= $line;
if(ereg("</epp>$", $result))
{
break;
}
}
For connecting to target server i use this code:
$ch = curl_init();
curl_setopt ($ch, CURLOPT_TIMEOUT, 90);
curl_setopt ($ch, CURLOPT_URL,"server:port");
curl_setopt ($ch, CURLOPT_HEADER, 0);
ob_start();
$result=curl_exec ($ch);
ob_end_clean();
curl_close ($ch);
And it work well for me.
I tried use curl post function instead fputs, but hasn't good result,
because target servers not receive required strings.
I try curl "put" option (putting data from file) and also haven't good
result, target server just loss connect.Could anyone give me idea, how i can
do it fputs by curl?
Thanking in advance
Azer
-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger
for complex code. Debugging C/C++ programs can leave you feeling lost and
disoriented. TotalView can help you find your way. Available on major UNIX
and Linux platforms. Try it free. www.etnus.com
Received on 2003-03-10