LIGHT
LIGHT

Reputation: 5712

How to access [_host:protected] in Zend Framework and PHP

Using Zend amazon service, I have fetched till there.

$url=$result->LargeImage->Url;
print_r($url);

the output of this is:

Zend_Uri_Http Object
(
    [_username:protected] => 
    [_password:protected] => 
    [_host:protected] => ecx.images-amazon.com
    [_port:protected] => 
    [_path:protected] => /images/I/41voDxJS62L.jpg
    [_query:protected] => 
    [_fragment:protected] => 
    [_regex:protected] => Array
        (
            [escaped] => %[[:xdigit:]]{2}
            [unreserved] => [A-Za-z0-9-_.!~*'()\[\]]
            [segment] => (?:%[[:xdigit:]]{2}|[A-Za-z0-9-_.!~*'()\[\]:@&=+$,;])*
            [path] => (?:\/(?:(?:%[[:xdigit:]]{2}|[A-Za-z0-9-_.!~*'()\[\]:@&=+$,;])*)?)+
            [uric] => (?:%[[:xdigit:]]{2}|[A-Za-z0-9-_.!~*'()\[\];\/?:@&=+$,])
        )

    [_scheme:protected] => http
)

We can't do echo $url->_host:protected here as 'protected' is keyword.

How do I access that? Can anyone help please?

Thanks

Upvotes: 1

Views: 1739

Answers (1)

GuillaumeS
GuillaumeS

Reputation: 1678

Use the getter.

$result->LargeImage->Url->getHost()

or

$url->getHost()

See the documentation : http://framework.zend.com/apidoc/1.9/Zend_Uri/Zend_Uri_Http.html

Upvotes: 3

Related Questions