$value){ $extdatastr .=urlencode($name)."=".urlencode($value)."&"; } $extdatastr = substr($extdatastr,0,strlen($extdatastr)-2); } else { $extdatastr=$extdata; } $fptr=fsockopen($site, $port, $errno, $errstr, $conntimeout); if(!$fptr){ $this->errflag=1; $this->lasterrno .= $errno; $this->lasterrdesc .= $errstr; } else { $datalen = strlen($extdatastr); // For POSTs create body with form data if($method=="POST"){ $bodystr = "POST ".$webpage." HTTP/1.0\r\n"; $bodystr .= "Host: ".$site."\r\n"; $bodystr .= "Content-type: application/x-www-form-urlencoded\r\n"; $bodystr .= "Content-length: ".$datalen."\r\n"; $bodystr .= "\r\n"; $bodystr .= $extdatastr."\n\n"; } // For GETs create body with passed QueryString if($method=="GET"){ if(strlen($extdatastr)>0){ $bodystr = "GET ".$webpage."?".$extdatastr." HTTP/1.0\r\n"; } else { $bodystr = "GET ".$webpage." HTTP/1.0\r\n"; } // For shared IPs $bodystr .= "Host: ".$site."\n\n"; } fputs($fptr, $bodystr); while(!feof($fptr)){ $returndata .= fgets($fptr, $buffer); } } return $returndata; } } /* Example Use of the gURL Class */ include("gurl.php"); $cururl = new gURL; // Data can be either string or an array. // Here's an array example $arypostdata["name"]="Markus Diersbock"; $arypostdata["company"]="SwingNote, LLC"; $arypostdata["address"]="5 Bessom Street Suite 119"; $arypostdata["city"]="Marblehead"; $arypostdata["state"]="MA"; $arypostdata["zip"]="01945"; $webresult = $cururl->execweb("www.targetsite.com", "/submissions.asp", $arypostdata, "POST"); printf("Result:

", $webresult); ?>