kingston_123 Posted January 15, 2017 Share Posted January 15, 2017 if I have this url: https://p-ams2.pcloud.com/cfZef5XTZVizxYkZNTGjZZsikL67Z2ZZKYRZZrYP6e7ZgVZQZTVZ4XZN7Zw7ZfVZBkZgXZLVZokZJ7ZxZ1XZ6MJPDKvi9cQXwzvKARfMHfHsN5WX/SH-LMP-SS-JUN15.zip Here is my codes: <?php $name="19875379"; $url = "https://p-ams2.pcloud.com/cfZef5XTZVizxYkZNTGjZZsikL67Z2ZZKYRZZrYP6e7ZgVZQZTVZ4XZN7Zw7ZfVZBkZgXZLVZokZJ7ZxZ1XZ6MJPDKvi9cQXwzvKARfMHfHsN5WX/SH-LMP-SS-JUN15.zip".$name; $ch = curl_init(); $timeout = 0; curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt($ch, CURLOPT_HEADER, TRUE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); $header = curl_exec($ch); $redir = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL); //print_r($header); $x = preg_match("/<script>location.href=(.|\n)*?<\/script>/", $header, $matches); $script = $matches[0]; $redirect = str_replace("<script>location.href='", "", $script); $redirect = "http://www.pcloud.com" . str_replace("';</script>", "", $redirect); echo $redirect; ?> & output is: Notice: Undefined offset: 0 in C:\xampp\htdocs\58.php on line 18 http://www.pcloud.com What wrong am I doing? Quote Link to comment https://forums.phpfreaks.com/topic/302934-how-to-parse-this-download-link-to-get-original-url/ Share on other sites More sharing options...
requinix Posted January 15, 2017 Share Posted January 15, 2017 Looks like you're trying to bypass something? Quote Link to comment https://forums.phpfreaks.com/topic/302934-how-to-parse-this-download-link-to-get-original-url/#findComment-1541402 Share on other sites More sharing options...
kingston_123 Posted January 15, 2017 Author Share Posted January 15, 2017 I need to get original URL which link works in any remote url upload with this php code. I am not bypassing any thing here with this php codes. Quote Link to comment https://forums.phpfreaks.com/topic/302934-how-to-parse-this-download-link-to-get-original-url/#findComment-1541403 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.