Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Try Using Curl:</p> <pre><code>/** * Get a web file (HTML, XHTML, XML, image, etc.) from a URL. Return an * array containing the HTTP server response header fields and content. */ function get_web_page( $url ) { $options = array( CURLOPT_RETURNTRANSFER =&gt; true, // return web page CURLOPT_HEADER =&gt; false, // don't return headers CURLOPT_FOLLOWLOCATION =&gt; true, // follow redirects CURLOPT_ENCODING =&gt; "", // handle all encodings CURLOPT_USERAGENT =&gt; "spider", // who am i CURLOPT_AUTOREFERER =&gt; true, // set referer on redirect CURLOPT_CONNECTTIMEOUT =&gt; 120, // timeout on connect CURLOPT_TIMEOUT =&gt; 120, // timeout on response CURLOPT_MAXREDIRS =&gt; 10, // stop after 10 redirects ); $ch = curl_init( $url ); curl_setopt_array( $ch, $options ); $content = curl_exec( $ch ); $err = curl_errno( $ch ); $errmsg = curl_error( $ch ); $header = curl_getinfo( $ch ); curl_close( $ch ); $header['errno'] = $err; $header['errmsg'] = $errmsg; $header['content'] = $content; return $header; } </code></pre> <p>Just call that function as-is with your url and it should echo out the whole webpage into the php page.</p> <p>However, you may need to rewrite links to assets, such as stylesheets and images using some regex. (Replace "/image.jpg" with "<a href="http://mydomain.com/image.jpg" rel="nofollow noreferrer">http://mydomain.com/image.jpg</a>").</p> <p>Curl usually is installed on shared hosts.</p> <p>If you want to just get the page's body, or head, you can use simplexml or regex expressions for that. (If the html is well-formed, simplexml is great for traversing the DOM).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload