The PLOT
I have created a page where there is a input field for URL. What I want it to do is that when a url is entered in the input box, it should validate it, then fetch 5(as many as available but less than 5 or 5). I have successfully written a jQuery script to take the URL entered and send it to a php file (using AJAX). I used the php code in this answer : https://stackoverflow.com/a/7995399/980049 but it's generating only one image. Plus -> it's using file_get_content()
function which, some are saying, is dangerous(not secure).
So, The Problem is:
The jQuery script is working fine as it can fetch the image. But the php code is only generating one image(first image).
NOTE: I have edited only the $url of the php code given in the answer and the rest is the same.
Edited Portion:
$url = $_POST['url']; // I am using type: POST in the jQuery AJAX script.