Hi, I'm currently trying to grab a file from an external url that has an authorization box that pops up (like the default one asking for a username and password) How can I have a script get the contents of the page (it's a video), save it to a directory and handle the authorization (i have a username and password) Thanks
I think what you mean is HTTP Authentication? - theirfore use cURL to login, use the following example and let me know how it goes, then use $response to proceed... <?php //the sites url... $url = ""; //self explanatory... $http_username = ""; $http_password = ""; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_USERPWD, $http_username . ":" . $http_password); curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($curl); curl_close($curl); //now use $response to proceed... ?> PHP:
I have a new issue, the file I'm trying to get is just posting, so how can I get the http request headers off it so i can find the main url of the video?
To turn off you can use curl_setopt($ch, CURLOPT_HEADER ,0); You can also have a look here http://curl.haxx.se/docs/manpage.html and for post data using cURL here http://www.askapache.com/htaccess/sending-post-form-data-with-php-curl.html
Not like posting stuff myself, but kinda simulate what the firefox live http headers does. edit: I could just decompile the swf on the server the explode the url out of it, anyone know how to decompile an swf?
Googling yields a solution for it Have a look here http://it.toolbox.com/blogs/adventuresinsecurity/decompiling-swf-files-19043