Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- $url = "https://example.com:2083/login?user=USER&pass=PASS";
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url); //set url
- curl_setopt($ch, CURLOPT_HEADER, true); //get header
- curl_setopt($ch, CURLOPT_NOBODY, true); //do not include response body
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //do not show in browser the response
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); //follow any redirects
- curl_exec($ch);
- $new_url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL); //extract the url from the header response
- $response = curl_exec($ch);
- curl_close($ch);
- echo $new_url
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement