Im using PHP simplexml to get a VAST xml file from the web. I need to get the values of some elements.
My code is this:
<?php
$myVAST = simplexml_load_file('http://mysite/ads/www/delivery/fc.php?script=bannerTypeHtml:vastInlineBannerTypeHtml:vastInlineHtml&zones=vimp_ads%3D5&nz=1&source=&r=323&block=1&format=vast&charset=UTF-8','SimpleXMLElement', LIBXML_NOCDATA);
$result = $myVAST->xpath("//Impression/URL");
print_r($result);
?>
Im getting this:
Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => primaryAdServer ) [0] => http://mysite/ads/www/delivery/lg.php?bannerid=7&campaignid=3&zoneid=5&loc=1&cb=2c53ba2469 ) )
I need to get only the url value:
http://mysite/ads/www/delivery/lg.php?bannerid=7&campaignid=3&zoneid=5&loc=1&cb=2c53ba2469
But im not being able to do that. I tried to cast to string but with no success.
Any ideas?
thank you,
fwu