Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $url ='http://www.example.com/file.html';
- //<a href="http://www.example.com/file/download/idsession">download</a>
- $opts = array(
- 'http'=>array(
- 'method'=>"GET",
- 'header'=>"Accept-language: en\r\n"
- )
- );
- $context = stream_context_create($opts);
- // Open the file using the HTTP headers set above
- $file = file_get_contents($url, false, $context);
- $filedom = new domDocument;
- @$filedom->loadHTML($file);
- $newfile = $filedom->getElementsByTagName('a');
- foreach($newfile as $hrefile){
- $dlurl = $hrefile->getAttribute('href');
- echo $dlurl;
- }
- // Write the contents back to the file
- //$filename = 'example.zip';
- //file_put_contents($filename,$hrefile);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement