Search
-
Recent Posts
Tags
adwords amazon analytics api apple aws blog chrome chromium cloud Design dropbox ec2 email error facebook firefox google google-apps homebrew ipad javascript jQuery linux lion mac microsoft mysql osx os x paypal php plugin quicksilver raspberry pi scam social spam twitter ubuntu unix video windows woo wordpress
Monthly Archives: December 2014
How to use http_build_url with pecl_http version 2.0 with PHP 5.4, 5.5, and 5.6
The old way to use http_build_url This is how to use http_build_url with pecl_http version 1.x: $parse = parse_url(‘http://example.com/index.asp?test=123#hash’); print_r($parse); # # Yields a result of: # # Array # ( # [scheme] => http # [host] => example.com # [path] => /index.asp # [query] => test=123 # [fragment] => hash # ) $url = http_build_url($parse); echo $url; # # Yields a result of: # # http://example.com/index.asp?test=123#hash The new way to use http_build_url with pecl_http version 2.x: This functionality has now moved into the http\Url class: $parse = parse_url(‘http://example.com/index.asp?test=123#hash’); print_r($parse); # # Yields a result of: # # Array # ( # [scheme] => http # [host] => example.com # [path] => /index.asp # [query] => test=123 # [fragment] => hash # ) $url = new \http\Url($parse); echo $url->toString(); # # Yields a result of: # # http://example.com/index.asp?test=123#hash #