TomG103 TomG103 - 2 months ago 23
PHP Question

PHRETS GetObject() returns array, need to extract URL

I'm performing a for loop to iterate through MLS listings. I'm able to get every bit of information I need but I can't seem to figure out how to extract the URL from the array I get.

Here's the array I get from my for loop:

PHRETS\Models\Object Object


[content_type:protected] => text/xml
[content_id:protected] => 9577056
[object_id:protected] => 1
[mime_version:protected] =>
[location:protected] =>
[content_description:protected] =>
[content_sub_description:protected] =>
[content:protected] =>

[preferred:protected] =>
[error:protected] => PHRETS\Models\RETSError Object
[code:protected] => 0
[message:protected] =>


The following is the code I'm using to get that output. I'm just wondering if there's a way to do a trim or something to extract the URL so I can store it.

for ($i = 0; $i <= count($listID); $i++) {

$photo = $rets->GetObject('Property', 'Photo', $mls, '*', 1);

foreach ($photo as $image) {
echo "<pre>";
echo "<br>";
echo "</pre>";


You mean like

foreach ($photo as $image) {
    echo 'Location: ', $image->getLocation(), '<br>';



The method is detailed here ~