Skip to content

Instantly share code, notes, and snippets.

@AramZS
Created February 3, 2015 22:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AramZS/fbf6ed175e9044bdfc64 to your computer and use it in GitHub Desktop.
Save AramZS/fbf6ed175e9044bdfc64 to your computer and use it in GitHub Desktop.
What a Bit.ly-style redirect looks like as a wp_remote_get response.
<?php
# via var_dump(wp_remote_get('http://nzzl.me/1xqgPpn',array('redirection' => 0)));
array(5) {
["headers"]=>
array(9) {
["server"]=>
string(5) "nginx"
["date"]=>
string(29) "Tue, 03 Feb 2015 22:34:52 GMT"
["content-type"]=>
string(24) "text/html; charset=utf-8"
["content-length"]=>
string(3) "147"
["connection"]=>
string(5) "close"
["cache-control"]=>
string(19) "private, max-age=90"
["location"]=>
string(55) "http://www.vox.com/2015/1/3/7482623/emerson-spartz-dose"
["mime-version"]=>
string(3) "1.0"
["set-cookie"]=>
string(100) "_bit=54d14d0c-0018d-06e9b-301cf10a;domain=.nzzl.me;expires=Sun Aug 2 22:34:52 2015;path=/; HttpOnly"
}
["body"]=>
string(147) "
moved here
"
["response"]=>
array(2) {
["code"]=>
int(301)
["message"]=>
string(17) "Moved Permanently"
}
["cookies"]=>
array(1) {
[0]=>
object(WP_Http_Cookie)#344 (6) {
["name"]=>
string(4) "_bit"
["value"]=>
string(29) "54d14d0c-0018d-06e9b-301cf10a"
["expires"]=>
int(1438554892)
["path"]=>
string(1) "/"
["domain"]=>
string(8) ".nzzl.me"
["httponly"]=>
string(0) ""
}
}
["filename"]=>
NULL
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment