Hi All,
I'm trying to connect to a public RETS test server (
http://www.mris.com/sites/default/files/pdfs/Agent-Application.June2014.pdf)Both the sample code for PHRETS 2 and 1.x fail to connect for me (with the same HTTP 400 response). I have verified that the server is running, and other tools (such as the CoreLogic Connector tool) can connect.
Sample output:
--------------------------------------
$response_body
: string = "<RETS ReplyCode=\"20036\" ReplyText=\"V2.7.0 4489: Realm value is invalid from the Authorization Request Header Argument\">\r\n</RETS>\r\n\r\n"
$this->last_response_headers
: array =
HTTP: string = "HTTP/1.1 400 Bad Request"
Server: string = "nginx"
Date: string = "Fri, 16 Oct 2015 02:04:06 GMT"
Content-Type: string = "text/plain;charset=ISO-8859-1"
Content-Length: string = "0"
Connection: string = "keep-alive"
Keep-Alive: string = "timeout=20"
X-Copyright: string = "Copyright 2015 Metropolitan Regional Information Systems, Inc., unauthorized use is prohibited."
Cache-Control: string = "private"
RETS-Version: string = "RETS/1.7.2"
WWW-Authenticate: string = "Digest realm=\"
us...@mris.com\", nonce=\"31343434393631303436373737202b5b625ffcdb9e07606f7e5efa1b1999\", opaque=\"6e6f742075736564\""
Transfer-Encoding: string = "chunked"
-----------------------------------
PHRETS 2.x code sample:
<?php
$rets_login_url = "http://ptest.mris.com:6103/ptest/login" ;
$rets_username = 'MRISTEST';
$rets_password = 'PMRISTEST';
$ver = "RETS/1.7.2";
$user_agent = "RETS Test/1.0";
date_default_timezone_set('America/New_York');
require_once("vendor/autoload.php");
$config = new \PHRETS\Configuration;
$config->setLoginUrl($rets_login_url);
$config->setUsername($rets_username);
$config->setPassword($rets_password);
$config->setRetsVersion('1.7.2');
$config->setUserAgent($user_agent);
$config->setHttpAuthenticationMethod('digest');
$config->setOption('use_post_method', false);
$config->setOption('disable_follow_location', true);
$rets = new \PHRETS\Session($config);
$connect = $rets->Login();
?> ----------------------------------------
PHRETS 1.x code sample:
<?php$login = 'http://ptest.mris.com:6103/ptest/login'; $un = 'MRISTEST';$pw = 'PMRISTEST';$ver = "RETS/1.7.2";$user_agent = "RETS Test/1.0";$rets = new PHRETS;$rets->AddHeader("User-Agent", $user_agent);$rets->AddHeader("RETS-Version", "RETS/1.7.2");/* Connect */$connect = $rets->Connect($login, $un, $pw);if($connect) { $types = $rets->GetMetadataTypes(); print_r($types); $rets->Disconnect();} else { $error = $rets->Error(); print_r($error);}?> ---------------------------Suggestions? It seems like this code should work, and that I must be overlooking something.
Environment: Env: PHP 5.5.25; win10 x64
Thanks in advance-
Graham