Skip to content Skip to sidebar Skip to footer

Getting A Webpage Content Using Php

Now this I know is relatively simple to do, but i want to use a form to get the URLs to use in this. I started using file_get_contents but then i switched to fopen.

Solution 1:

Set $page before $marki, like -

$page = $_GET['page'];
$marki = fopen($page, "rb");

Solution 2:

When you were using 'file_get_contents' did you put 'http://' in front of the url? If you didn't, it will try and find the url on your own server. See below :

<?php$homepage = file_get_contents('http://www.example.com/');
echo$homepage;
?>

And the official documentation PHP:file_get_contents

Post a Comment for "Getting A Webpage Content Using Php"