i wonder if it is possible to fetch images using PHP Simple HTML DOM Parser and obtain it in a specific URL. Suppose it fetched a Image in a variable like
$img = 'http://www.example.com/some_image_address.JPEG';
Now is it possible to get this image in my own domain path, like
$new_img = 'http://mysite.com/some_image_address.JPEG';
I am a PHP beginner so please describe it

Member Avatar
LastMitch

@rakibtg

Just follow Quick Start.

Member Avatar
diafol

Personally I'd use vanilla php.

Here's an example:

<?php

function xsrc($url){
    return "http://www.my_site.com/myfolder/" . basename($url);
}

//Two liner 
$img = xsrc('http://www.example.com/free_images/treacle1.png');
echo "<img src='$img' />";

//One liner
echo '<img src="' . xsrc('http://www.example.com/free_images/treacle.png') . '" />';

//HEREDOC SYNTAX
echo <<<IMG
<img src="$img" />
IMG;

?>
<!-- HTML WITH INLINE PHP -->
<img src="<?php echo xsrc('http://www.example.com/free_images/treacle.png');?>" />
<img src="<?php echo $img;?>" />