title: simplexml_load_file not working "php_network_getaddresses: failed: Name or service not known"
body: <p>I started getting these warnings just recently, im not sure why, nor do i know how to fix it. What confuses me more, it was working before, i started working on another class and now i starting getting this error...</p>
  
  <p>im using linux fedora &amp; apache for the webserver.</p>
  
  <blockquote>
    <p>Warning: simplexml_load_file()
    [function.simplexml-load-file]:
    php_network_getaddresses: getaddrinfo
    failed: Name or service not known in
    GetImagesFlickr.php
    on line 17</p>
    
    <p>Warning:
    simplexml_load_file(http://api.flickr.com/services/rest/?method=flickr.photos.search&amp;api_key=9eb9f5e5fb72d6d2fed06cf4e64ba9bb&amp;media=photos&amp;per_page=50&amp;text=fgdc)
    [function.simplexml-load-file]: failed
    to open stream:
    php_network_getaddresses: getaddrinfo
    failed: Name or service not known in
    GetImagesFlickr.php
    on line 17</p>
    
    <p>Warning: simplexml_load_file()
    [function.simplexml-load-file]: I/O
    warning : failed to load external
    entity
    "http://api.flickr.com/services/rest/?method=flickr.photos.search&amp;api_key=9eb9f5e5fb72d6d2fed06cf4e64ba9bb&amp;media=photos&amp;per_page=50&amp;text=fgdc"
    in
    /var/www/html/yahoo/GetImagesFlickr.php
    on line 17</p>
  </blockquote>
  
  <pre><code>&lt;?php
  class GetImagesFlickr
  {
      const API_KEY = "***"; // Flickr api key
      const MAX_RESULTS_RETURNED = 50; // Max results returned in search
  
      private $url; // Flickr webservice url
  
      public function __construct () 
      {
          $this-&gt;url = "http://api.flickr.com/services/rest/?method=flickr.photos.search&amp;api_key=".self::API_KEY."&amp;media=photos&amp;per_page=".self::MAX_RESULTS_RETURNED;
      }
  
      public function getImages ($search_term)
      {
          // Perform search and store xml data
          $xml_data = simplexml_load_file("{$this-&gt;url}&amp;text={$search_term}");
  
          $search_results = array();
  
          // Go through xml data and store to array
          foreach ($xml_data-&gt;photos-&gt;photo as $current_photo)
          {
              $id = $current_photo['id'];
                          $title = $current_photo['title'];
              $farm = $current_photo['farm'];
              $secret = $current_photo['secret'];
              $server = $current_photo['server'];
              $url = "http://farm{$farm}.static.flickr.com/{$server}/{$id}_{$secret}.jpg";
  
              $complete_photo = array (
                  'id'     =&gt; $id,
                                  'title'  =&gt; $title,
                  'farm'   =&gt; $farm,
                  'secret' =&gt; $secret,
                  'server' =&gt; $server,
                  'url'    =&gt; $url
              );
  
              $search_results[] = $complete_photo;
          }
  
          return $search_results;
      }
  }
  ?&gt;
  </code></pre>