Last active
March 25, 2020 05:11
-
-
Save yathu/3388f27a415c7b17fe4c1c3d4210b989 to your computer and use it in GitHub Desktop.
torontomls listing sample code using PHRETS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//error_reporting(0); | |
date_default_timezone_set('America/New_York'); | |
require_once("../vendor/autoload.php"); | |
try { | |
$config = new \PHRETS\Configuration; | |
$config->setLoginUrl('http://rets.torontomls.net:6103/rets-treb3pv/server/login') | |
->setUsername('Username') | |
->setPassword('Password') | |
->setUserAgent("UserAgent") | |
->setUserAgentPassword("UserAgentPassword") | |
->setRetsVersion('1.7'); //depend on your provider | |
$rets = new \PHRETS\Session($config); | |
$connect = $rets->Login(); | |
if (!$connect) { | |
print_r("Error connect:".$rets->Error()); | |
} | |
echo "+ Connect: ".$connect; | |
echo "<br>"; | |
} catch (Exception $e) { | |
echo 'Caught exception: ', $e->getMessage(), "\n"; | |
} | |
$system = $rets->GetSystemMetadata(); | |
//var_dump($system); | |
echo "Results:"; | |
echo "<br/>"; | |
$results = $rets->Search('Property', 'ResidentialProperty', '(Area_code=01)', array('Limit' => 10)); | |
foreach ($results as $r) { | |
echo "<pre>"; | |
echo('Ad text: '.$r['Ad_text']); | |
echo "<br/>"; | |
echo('Address: '.$r['Addr']); | |
echo "<br/>"; | |
echo('Price: '.$r['Lp_dol']); | |
echo "</pre>"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ho can I get the following credential from torontomls.net?
->setUsername('Username')
->setPassword('Password')
->setUserAgent("UserAgent")
->setUserAgentPassword("UserAgentPassword")