title: Check URL is available Using PHP. if URL is available load the iframe
body: <p>Hi I have to check the URL is found or not.If the URL is available I need to load the <code>URL</code> in <code>iframe</code>.How can we do this?</p>
  
  <p>My sample Code</p>
  
  <pre><code>&lt;?php
      $url = 'http://example.com/t/urlname';
      $handle = curl_init($url);
  curl_setopt($handle,  CURLOPT_RETURNTRANSFER, TRUE);
  
  /* Get the HTML or whatever is linked in $url. */
  $response = curl_exec($handle);
  
  /* Check for 404 (file not found). */
  $httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
  if($httpCode == 404) {
      /* Handle 404 here. */
      echo "Url Not found";
  
  } else { ?&gt;
  
                      &lt;div id="iframe-comments"&gt;
              &lt;iframe  src="&lt;?php echo $url; ?&gt;" scrolling="no" style="width: 800px; height: 800px;"&gt; 
                  &lt;/iframe&gt;
  
  &lt;/div&gt;
  &lt;?php 
  }
  
  curl_close($handle);
      ?&gt;
  </code></pre>
  
  <p>In this case,If URL is available it's not loading/showing the <code>iframe</code> <code>Div</code>. Please suggest the better option for loading <code>iframe</code></p>