$agent_list = ""; // Your state division licence number
$list_status = "ACT"; // ACT, CLOSD, CONTE, CONTC, EXP, WITH, TEMP, AUCT, PEND, - These are the listing status types
// this is the list of field data you want returned from the request, the full list is in RETS-RES_data_fields.txt, be warned, most are gibberish or empty.
$list_data = "MLSNUM,PROPSUBTYPE,STREETNUM,UNITNUM,STREETDIR,STREETNAME,CITY,ZIPCODE,LISTPRICE,LISTSTATUS,REMARKS,PHOTOCOUNT,AGENTLIST,OFFICELIST,SQFTAVAIL,YEARBUILT,SCHOOLDISTRICT,SUBDIVISION,STYLE,BEDS,BATHSFULL,BATHSHALF";
// do you want to see the brain damage going on in the background?
$show_comments = "on";
// set the server, username, password and mlsid you were given.
$server = 'rets.cbr.mlsrets.com';
$username = ''; // your username from CBR
$password = ''; // your password from CBR
$mlsid = 'rets@marketlinx.com';
// announce the name of your script to the server
$user_agent = 'Agenthelper RETS Example AH/0.5'; // You can change this reflect your own project.
// make no changes below this line
$port = 80;
$login_area = 'GET /rets/login HTTP/1.1';
$login_uri = '/rets/login';
$rets_version = 'RETS/1.5';
$qop = 'auth';
$nc = '00000001';
$nonce = '';
$opaque = '';
$response = '';
$prop_return = '';
$i = 1;
function RETS_CONNECT($server, $port, $out, $show_comments, $response){
// This ensures that all connections are closed.
$out .= "Connection: Close\r\n\r\n";
// Creates socket connection to the RETS server
$fp = fsockopen($server,$port,$errno,$errstr,30);
// IMPORTANT - This checks to make sure the socket connection is a valid socket connection
// If this wasn't done, and the connection wasn't a valid resource it can send the script into
// an endless loop and bomb the server
if(!is_resource($fp)){
if ($show_comments == "on") { echo 'This connection is not a valid connection.
This script has been stopped to ensure your server does not crash.';}die;exit;
}
else {
if ($show_comments == "on") { echo '
?' . $out . ' ?';} fputs($fp, $out); while (!feof($fp)) { $response .= fgets($fp, 128); } fclose($fp); if ($show_comments == "on") { echo '
! ' . $response . ' !';} return $response; } // Used to strip nonce, auth, opaque, and session id function PARSE_RESPONSE($haystack, $needle){ return substr(strstr($haystack, $needle),(strlen($needle) + 1),32); } ?>