Failing to get DDF data in STANDARD-XML format with PHRETS

135 Views Asked by At

Until now we were working with DDF feed fetching the data in the default COMPACT-Decoded Format and getting the data properly. However, based on the docs, some data is only available in STANDARD-XML.

enter image description here

enter image description here

When I request the data in STANDARD-XML I get no records at all.

I am using the latest PHRETS library and my test code looks like this.

public function test()
{
    $this->connect();

    return $this->rets->Search(
        'Property',
        'Property',
        'ID=26352397',
        ['Limit' => 1, 'Format' => 'STANDARD-XML']
    );
}

And the return from this function:

$value = $this->ddfService->test();
$io->success(var_export($value->toArray(), true));

This just gives an empty array.

What am I missing? Is there any other way to get these fields?

UPDATE Here are some logs:

[2024-01-17T20:26:54.674761+00:00] PHRETS.DEBUG: Loading Monolog\Logger logger [] []
[2024-01-17T20:26:54.675622+00:00] PHRETS.DEBUG: Sending HTTP Request for https://data.crea.ca/Login.svc/Login (Login) {"auth":["qeoMsug6JDuY5VrxNT3CZJGq","S0uuYshvCPegrzypREFO4gdN","digest"],"headers":{"User-Agent":"PHRETS/2.6.4","RETS-Version":"RETS/1.7.2","Accept-Encoding":"gzip","Accept":"*/*"},"curl":{"10031":"/private/tmp/phrets6LOrCo"}} []
[2024-01-17T20:26:55.385730+00:00] PHRETS.DEBUG: Response: HTTP 200 [] []
[2024-01-17T20:26:55.397311+00:00] PHRETS.DEBUG: Sending HTTP Request for https://data.crea.ca/Search.svc/Search (Search) {"auth":["qeoMsug6JDuY5VrxNT3CZJGq","S0uuYshvCPegrzypREFO4gdN","digest"],"headers":{"User-Agent":"PHRETS/2.6.4","RETS-Version":"RETS/1.7.2","Accept-Encoding":"gzip","Accept":"*/*"},"curl":{"10031":"/private/tmp/phretsqtA0ET"},"query":{"SearchType":"Property","Class":"Property","Query":"(ID=26352397)","QueryType":"DMQL2","Count":1,"Format":"STANDARD-XML","Limit":null,"StandardNames":0}} []
[2024-01-17T20:26:55.612069+00:00] PHRETS.DEBUG: Response: HTTP 200 [] []
[2024-01-17T20:26:55.632945+00:00] PHRETS.DEBUG: Assuming TAB delimiter since none specified in response [] []
[2024-01-17T20:26:55.633008+00:00] PHRETS.DEBUG: 1 column headers/fields given [] []
[2024-01-17T20:26:55.633047+00:00] PHRETS.DEBUG: 1 total results found [] []
[2024-01-17T20:26:55.633068+00:00] PHRETS.DEBUG: 0 results given [] []
1

There are 1 best solutions below

0
On BEST ANSWER

You are querying the CREA server. PHRETS is unable to parse CREA responses in the STANDARD-XML format, as explained here:

data could be returned to the programmer, rather than failing with,

[2016-02-03 01:56:41] PHRETS.DEBUG: 51 total results found [] []
[2016-02-03 01:56:41] PHRETS.DEBUG: 0 results given [] []

because the parser is failing and can't read anything that isn't in <COLUMNS> & <DATA>.

As a workaround, you can try using a custom Strategy as described here.

Alternatively, you can try the solution given here.