Hi,
I am trying to write a script to pull real estate listing from a site using KoldFuzion. I am not getting an error here but I can seem to get data back either.
The $buffer variable from the fgets() is always empty.
====> My php code is below **************
<?php
$posting = "typesearch=bycity city= zip='43221' Ptyp=Single Family Home minprice=140000 maxprice=300000 MinBed= MinBath=2 pics= BeginSearch=Begin Search ";
$postlength = strlen($posting);
//building the string below
$ktstring = "POST http://www.somerealty.com/public/srchnew.cfm HTTP/1.0\r\n";
$ktstring .= "Host: www.somerealty.com\r\n";
$ktstring .= "Content-Length: $postlength\r\n";
$ktstring .= "Content-Type: application/x-www-form-urlencoded\r\n";
$ktstring .= "Connection: Close\r\n";
$getoneline = true; //used so I don't loop through the entire file
$fp = fsockopen ("www.somerealty.com", 80, $errno, $errstr, 30);
if (!$fp)
{
echo "$errstr ($errno)<br>\n";
}
else
{
fputs ($fp, $ktstring . $posting );
while (!feof($fp))
{
$buffer = fgets ($fp,1450);
if($getoneline)
{
echo "The buffer is: $buffer -correct?";
echo "<br><br><b>";
echo "Got 1450 bytes here, thatz all</b><br><br>\n";
$getoneline = false;
fclose ($fp);
break;
}
else
{
echo "<br><br><b>";
echo "The get one line variable was false</b><br><br>\n";
fclose ($fp);
break;
fclose ($fp); }
}
}
echo "\n<br><br><br>Well if this works the stuff above is from the raw file returned from the web site<br>\n";
**** end of code
Any ideas????
Any help would be appreciated.
My original idea would be to get a sniffer or script to evaluate THE EXACT and COMPLETE - post from the site itself, I was only able to get the post vars.
So if you can help thanks!!!