Actually i want to open a socket connection to the remote server say www.domainname.com/cgi-bin/filename.cgi?param1=aaa¶m2=bbbb
with this query in fsockopen, the remote server is giving an "internal server error" message.
so i tried fsockopen to connect to the root of the site only (like www.domainname.com).
But with this code also the remote server is not returning anything except the follwing response
HTTP/1.1 200 OK Date: Fri, 17 May 2002 09:51:12 GMT Server: Apache/1.3.22 (Unix) Last-Modified: Wed, 13 Dec 2000 10:19:59 GMT ETag: "2a54e-26a-3a374d4f" Accept-Ranges: bytes Content-Length: 618 Connection: close Content-Type: text/html
My question is am i actually getting connected to the remote server, because the response string shows the words "Connection: close"
Also i want a code that will connect to the cgi file in the cgi-bin directory.
The code i am using right now to connect to the root of the site is-
($site_domain is already assigned the value)
$fp = fsockopen($site_domain, 80, $errno, $errstr, 30);
if(!$fp)
{
echo "Error=$errstr ($errno)<br>\n";
}
else
{
echo "in else<br>";
fputs ($fp, "GET / HTTP/1.0\r\nHost: $site_domain\r\n\r\n");
while(!feof($fp))
{
echo fgets ($fp,128);
}
fclose ($fp);
}
is there any error in this code? please help.
one more question at the end
Can any site have the fsockopen function disabled?
i have checked & checked my code many times? i could spot any error for things to go like this !
any help would be greately appreciated !
thanks