I am fetching url like facebook. For all images in that page I get them with
$src = $tag->getAttribute('src');
it works fine if the foreign site put a full webpath to their images. But sometimes they use relative path only and that returns a broken image.
Since I have the full url, is there a way to check if $src contains http://
or https
?
if not then I could do
$src = $link . '/' . $src;
for those relative images. I tried, they display. But if they already had it, then they will not display as path then contains double url.
No comments:
Post a Comment