getting content of URL via fopen and fread to variable


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $handle = fopen("http://www.google.com", "r");
  2. $contents = '';
  3. while (!feof($handle)) {
  4. $contents .= fread($handle, 8192);
  5. }
  6. fclose($handle);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.