Created
March 20, 2012 00:33
-
-
Save missinglink/2129047 to your computer and use it in GitHub Desktop.
A complete HACK to emulate most of functionality of http_build_url() from http_pecl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A complete HACK to emulate most of functionality of http_build_url() from http_pecl | |
*/ | |
ob_start(); | |
empty( $this->scheme ) || printf( '%s://', $this->scheme ); | |
empty( $this->user ) || printf( '%s%s@', $this->user, | |
empty( $this->pass ) ?'': sprintf( ':%s', $this->pass )); | |
empty( $this->host ) || print( $this->host ); | |
empty( $this->port ) || printf( ':%d', $this->port ); | |
empty( $this->path ) ? print( '/' ) : print( $this->path ); | |
empty( $this->query ) || printf( '?%s', $this->query ); | |
empty( $this->fragment ) || printf( '#%s', $this->fragment ); | |
return ob_get_clean(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment