title: Calling API by IP address vs domain name
body: <p>During a recent DDoS attack on a DNS, my site was unable to continue to function.</p>
  
  <p>While the main site remained up and running, I was unable to connect to an external API on a different domain, leading the site to become completely unusable.</p>
  
  <p>The data is fetched using PHP:</p>
  
  <pre><code>file_get_contents(API_PATH)
  </code></pre>
  
  <p>I currently call the API using the domain name, but I'm able to use the IP address if required.</p>
  
  <p>Are there any advantages/disadvantages of calling the API by IP?</p>
  
  <p>Is there anything else I should be aware of before making this change?</p>