Extract URL contents using PHP, JQuery and AJAX

Do you want to extract url contents and display it to the user before he posts it to your site?…..

Just check it out the below code….

1. Starting with Basic HTML





<textarea id=”urls” cols=”40″ rows=”8″ placeholder=”Enter a url here…”></textarea>

<div id=”extr”></div>



2. The Javascript Code

Insert this code between the head tag of your html file….

<script src=”http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js></script>





type: “POST”,

url: “extract.php”,

data: “url=” + $(‘#urls’).val(),

cache: false,









3.The extract.php file




$url = $_POST[‘url’];

                                  if($url == ”)


                                           echoURL Mustnot be Empty…Please Enter something…“;



                                       echo file_get_contents($ur;);





Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s