PHP reading a page on my site
<p>I'm trying to open read a page on my own website for a search engine I'm trying to get working.
I've tried several ways of doing it:<br>
<strong>file_get_contents</strong>  </p>

<pre><code>$temp = file_get_contents("http://www.mysite.com/example01/");
echo $temp;
</code></pre>

<p>returns:</p>

<blockquote>
  <p>Warning:
  file_get_contents(http://www.mysite.com/example01/)
  [function.file-get-contents]: failed
  to open stream: A connection attempt
  failed because the connected party did
  not properly respond after a period of
  time, or established connection failed
  because connected host has failed to
  respond. in
  C:\inetpub\wwwroot\mysite\example01\temp.php
  on line 66</p>
</blockquote>

<p><strong>curl</strong></p>

<pre><code>function curl($url){
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HEADER, true); // Display headers
    curl_setopt($ch, CURLOPT_VERBOSE, true); // Display communication with server       
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    print "&lt;pre&gt;\n";
    print_r(curl_getinfo($ch));  // get error info
    echo "\n\ncURL error number:" .curl_errno($ch); // print error info
    echo "\n\ncURL error:" . curl_error($ch); 
    print "&lt;/pre&gt;\n";

    return curl_exec($ch);
    curl_close($ch);
}
$temp = curl("http://www.mysite.com/example01/");
echo "'$temp'";
</code></pre>

<p>returns:</p>

<blockquote>
  <p>Array (
      [url] => <a href="http://www.jlwarranty.com/example01/" rel="nofollow">http://www.jlwarranty.com/example01/</a>
      [http_code] => 0
      [header_size] => 0
      [request_size] => 0
      [filetime] => 0
      [ssl_verify_result] => 0
      [redirect_count] => 0
      [total_time] => 0
      [namelookup_time] => 0
      [connect_time] => 0
      [pretransfer_time] => 0
      [size_upload] => 0
      [size_download] => 0
      [speed_download] => 0
      [speed_upload] => 0
      [download_content_length] => 0
      [upload_content_length] => 0
      [starttransfer_time] => 0
      [redirect_time] => 0 )</p>
  
  <p>cURL error number:0  </p>
  
  <p>cURL error: </p>
  
  <p>''</p>
</blockquote>

<p>it takes about 30 seconds to get the page to reload.</p>

<p>cURL is enabled in php.ini, and so is allow_url_fopen.</p>
