hi,

i need a expert of php and perl. i have a php program here, i need someone to convert the php code into perl, the php code is listed in the following, i have been trying to write a new code in perl, but does not work, i really appreciate if any of u can help me on this.

php code :-

function get_headers1($url,$format) {
$string = "0a";
$hstring = pack('H*', $string);
$url_info=parse_url($url);
$port = isset($url_info['port']) ? $url_info['port'] : 80;
$fp=fsockopen($url_info['host'], $port, $errno, $errstr, 30);
if($fp) {
$head = "HEAD ".@$url_info['path']."?".@$url_info['query'];
$head .= " HTTP/1.0\r\nHost: ".@$url_info['host']."\r\n";
$head .= " \r\npassname: ".urlencode('passname')."\r\n";
$head .= " \r\npassword: ".urlencode('password')."\r\n";
$head .= " \r\ntrx_id: ".urlencode('0')."\r\n";
$head .= " \r\nshort_code: ".urlencode('xxxxx')."\r\n";
$head .= " \r\noriginating_no: ".urlencode('xxxxx')."\r\n";
$head .= " \r\ndestination_no: ".urlencode('xxxxx')."\r\n";
$head .= " \r\ncp_ref_id: ".urlencode('0')."\r\n";
$head .= " \r\nbill_type: ".urlencode('0')."\r\n";
$head .= " \r\nbill_price: ".urlencode('0')."\r\n";
$head .= " \r\ncontent_type: ".urlencode('1')."\r\n";
$head .= " \r\nmsg: ".urlencode('this is a test')."\r\n";
$head .= " \r\nbulk_fg: ".urlencode('1')."\r\n\r\n";
//echo $head."
";
//$head .= " \r\ndomain: ".$_POST['txtDomainName'].".".$_POST['comboDomainRoot']."\r\n\r\n";
fputs($fp, $head);
while(!feof($fp)) {
if($header=trim(fgets($fp, 1024))) {
echo $header."
";
//echo $errno." ".$errstr."
";
if($format == 1) {
$h2 = explode(':',$header);
// the first element is the http header type, such as HTTP/1.1 200 OK,
// it doesn't have a separate name, so we have to check for it.
if($h2[0] == $header) {
$headers['status'] = $header;
}
else {
$headers[strtolower($h2[0])] = trim($h2[1]);
}
}
else {
$headers[] = $header;
}
}
}
return $headers;
}
else {
return false;
}
}
$data = get_headers1("(URL address blocked: See forum rules):81/test.aspx", 1);
?>