title: trying to fetch all the images in a page using xpath
body: <p>i am trying to catch all the images on a page using Xpath and then iterating through the node list checking if the image has attribute if it does i iterate through the attributes till i get to src now my problem is when i get relative paths like <code>/us/english/images/12/something.jpeg</code> or something like that.. my question is: is there a way go get the full path ?</p>
  
  <p>I thought of regex the returned src and look for host if host isn't there use the site's url but that can be hard to check for..</p>
  
  <p>i also thought maybe i should parse url and check for ['host'] part if the host part has "."dot meaning there is host and i shouldn't add it ?</p>
  
  <p>Here is what i have so far:</p>
  
  <pre><code>$image_list = $xpath-&gt;query('//img');
      foreach($image_list as $element){
          if($element-&gt;hasAttributes()){
              foreach($element-&gt;attributes as $attribute){
                  if(strtolower($attribute-&gt;nodeName) == 'src'){
                      echo $attribute-&gt;nodeName. ' = ' .$attribute-&gt;nodeValue.'&lt;br&gt;';
                  }
  
              }
          }
      }
  </code></pre>
  
  <p>would appreciate any help.</p>