How can I change the code below to localhostGetAllPic. php? The URL after urlxxxurl is the URL to be submitted. you don't need to click the submit button. if you want to know it, you can directly send it to the code. thanks & lt ;? Phprequire_once & nbsp; DownImage. class. php ;? & Gt; & lt; html & gt; & lt; head & gt; modify a piece of code
How can I change the following code to http: // localhost/GetAllPic. php? Url = xxx
Url = the following url is the url to be submitted. do not click the submit button.
Thank you!
Require_once 'downimage. class. php ';
?>
Download all images on the webpage
Share:
------ Solution --------------------
function modify_build_url($params = array(), $url = NULL) {
//my_debug(current_url());
if (! $url) {
$url = $_SERVER ['REQUEST_URI'];
}
$parts = parse_url ( $url );
if (! is_array ( $parts )) {
$parts = array ();
}
if (! array_key_exists ( 'host', $parts )) {
$parts ['host'] = $_SERVER ['HTTP_HOST'];
}
$gets = array ();
if (array_key_exists ( 'query', $parts )) {
$query = $parts ['query'];
parse_str ( $query, $gets );
}
if (! is_array ( $params )) {
$params = array ();
}
if (! is_array ( $gets )) {
$gets = array ();
}
foreach ( $params as $k => $v ) {
$gets [$k] = $v;
}
$path = null;
if (array_key_exists ( 'path', $parts )) {
$path = $parts ['path'];
}
if (! $path) {
$path = "/";
}
$ret = sprintf ( "http://%s%s?%s", $parts ['host'], $path, http_build_query ( $gets ) );
return $ret;
}