i am writing a simple script to list all the files of an external sites directory. i am using curl for this. the code i have written is below
$url="http://externalsite.com/directory/";
$ch = curl_init();
curl_setopt($ch, CURLOPT_AUTOREFERER, FALSE);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FTPLISTONLY, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
$data = curl_exec($ch);
curl_close($ch);
echo $data;
but when i execute the above code it is showing the contents of the index.php file which is in the directory. how to list all the files in the directory without redirecting it to index.php file ?