Get Url Response Using Php ( Curl ) -


i have url http://www.example.com?auth_key=vvaf3spun3zetrh0kvpg1, when open url or if header location php redirects me same url 1 more $_get value appended become

http://www.example.com?auth_key=vvaf3spun3zetrh0kvpg1&&auth_token=otdzn36qbpno, , access it's value using $_get['auth_token'].

is there way make request first url using curl or other method in php , $_get['auth_token'] value response.

using curl curlopt_returntransfer, set curlopt_followlocation true, not if safe_mode or open_basedir enabled. on same manual page can find function overcome if needed, though. curlopt_header should see redirection header location: newurl in output string. can extract parameter that, e.g. this:

list($dummy, $location) = explode(':', $location_line, 2); $parts = parse_url(trim($location)); if (isset($parts['query'])) { parse_str($parts['query'], $param_map); if (isset($param_map['auth_token'])) { ... 

Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -