Strange characters in http output.
Posted: Thu May 01, 2003 3:16 pm
I am using PHP to GET and display a page. When I display the output, I am getting strange characters in the output.
Here is an example:
http://www.justmaui.com/ram_get.php?dbi ... 5&task=new
Under the “Main Page” link there is “fea” and “1000” that shouldn’t be there. Sometimes the characters show up in the middle of tags, like between the b and g of a bgcolor. This happens even calling plain html pages, and I’ve seen it in both ie6 and ns7.
The code:
<?php
$site = 'http://www.justmaui.com';
switch ($task) {
case "search":
$link = '/search.mv?dbid='.$dbid;
search($link,$site);
break;
case "new":
$link = '/new_listings.mv?days_back=7&dbid='.$dbid;
search($link,$site);
break;
default:
break;
}
function search($link,$site)
{
$fp = fsockopen('www.mauiboard2.com',80);
fputs($fp, "GET $link HTTP/1.1\r\n");
fputs($fp, "Host: http://www.mauiboard2.com\r\n");
fputs($fp, "Referer: $site\r\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
fputs($fp, "User-Agent: RAM-GET\r\n");
fputs($fp, "Connection: close\r\n\r\n");
while (!feof($fp))
{
$output .= fgets($fp,1024);
}
$output = str_replace('VALUE="justmaui.com"', 'VALUE=""', $output);
$output = str_replace('url=justmaui.com', 'url=', $output);
echo $output;
fclose ($fp);
}
?>
Thanks for any help!
Here is an example:
http://www.justmaui.com/ram_get.php?dbi ... 5&task=new
Under the “Main Page” link there is “fea” and “1000” that shouldn’t be there. Sometimes the characters show up in the middle of tags, like between the b and g of a bgcolor. This happens even calling plain html pages, and I’ve seen it in both ie6 and ns7.
The code:
<?php
$site = 'http://www.justmaui.com';
switch ($task) {
case "search":
$link = '/search.mv?dbid='.$dbid;
search($link,$site);
break;
case "new":
$link = '/new_listings.mv?days_back=7&dbid='.$dbid;
search($link,$site);
break;
default:
break;
}
function search($link,$site)
{
$fp = fsockopen('www.mauiboard2.com',80);
fputs($fp, "GET $link HTTP/1.1\r\n");
fputs($fp, "Host: http://www.mauiboard2.com\r\n");
fputs($fp, "Referer: $site\r\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
fputs($fp, "User-Agent: RAM-GET\r\n");
fputs($fp, "Connection: close\r\n\r\n");
while (!feof($fp))
{
$output .= fgets($fp,1024);
}
$output = str_replace('VALUE="justmaui.com"', 'VALUE=""', $output);
$output = str_replace('url=justmaui.com', 'url=', $output);
echo $output;
fclose ($fp);
}
?>
Thanks for any help!