jakeasmith / http_build_url Goto Github PK
View Code? Open in Web Editor NEWProvides functionality for http_build_url() to projects without pecl_http.
License: MIT License
Provides functionality for http_build_url() to projects without pecl_http.
License: MIT License
Hello,
I'm sorry, I don't know if this is a real bug,
and if the original function (of pecl) has same output, i never work with it
Anyway:
http_build_url([ 'user' => 'abc', 'pass' => 123]);
abc:123@/
I'm not sure if @/
are correct for output...
Can something check in original pecl version ?
As title, doe this project still maintain?
Thanks.
Example:
http_build_url(
"http://site.testing.com/apreview/testing/a/09-20a13/pa0a4/?code=asdfghjkl",
array('path' => 'image/15.jpg'),
HTTP_URL_JOIN_PATH | HTTP_URL_STRIP_FRAGMENT | HTTP_URL_STRIP_QUERY
);
Results in:
'http://site.testing.com/preview/testing//09-2013/p04/image/15.jpg'
Somehow this doesn't seem like it's working correctly
http_build_url(array(
'scheme' => 'http',
'host' => 'example.com',
'path' => 'yes'
));
Output
http://example.comyes
Expected Output
http://example.com/yes
Feel free to nuke this issue if this is the intended behavior
I'm getting a port and path collision like this:
ftp://username:[email protected]:21public_html
Check out: :21public_html
Reproduce:
Example url: "www.example.com/?authtoken=1234"
If we try to remove the authtoken params like so
$urlParts = parse_url($url);
$queryParameters = array();
parse_str($urlParts['query'], $queryParameters);
unset($queryParameters['authtoken']);
$urlParts['query'] = $queryParameters;
$newUrl = http_build_url($urlParts);
The new url is:
"www.example.com/?Array"
@jakeasmith:
Installed this composer package: composer require jakeasmith/http_build_url ^1
How to autoload it? I can't rely on hardcoded paths to the PHP file.
use jakeasmith\http_build_url;
doesn't work as PHP still can't find the http_build_url
method.
Just leaving this as a comment for anyone who would wonder about the PHP requirements of this library: it works from PHP 5.0.0 to 5.6.8 and 7
Given this configuration
['scheme' => 'http', 'host' => 'example.com']
I'm expecting this output http://example.com
but http://example.com/
is given
Same goes for ['scheme' => 'http', 'host' => 'example.com', 'path' => '']
Hey Jake - great implementation and useful library. Would it be possible for you to include an explicit license?
I haven't written PHP in years and it seems there are people still using this. If someone from the PHP community is interested in taking over this I will happily hand it over. This package does have a surprising amount of monthly downloads, so while I don't have a particular process in mind, it would be good to see a few people vouch for the new maintainer.
Given the following test case:
public function testJoinPathTwo()
{
$expected = "http://site.testing.com/preview/testing/09-2013/p04/image/15.jpg";
$actual = http_build_url(
"http://site.testing.com/preview/testing/09-2013/p04/?code=asdfghjkl",
['path' => 'image/15.jpg'],
HTTP_URL_JOIN_PATH | HTTP_URL_STRIP_FRAGMENT | HTTP_URL_STRIP_QUERY
);
$this->assertSame($expected, $actual);
}
I expect to get http://site.testing.com/preview/testing/09-2013/p04/image/15.jpg
I actually get http://site.testing.com/preview/testing/09-2013/image/15.jpg
I think the code:
if (isset($url['path'])) {
$parsed_string .= $url['path'];
} else {
$parsed_string .= '/';
}
should be replaced with:
if (!empty($url['path'])) {
$parsed_string .= $url['path'];
} else {
$parsed_string .= '/';
}
because if $url['path'] element is empty - we won't get '/' at the end of the url, which is required by the original behavior.
There have been many commits since v1.0.0. ;-)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.