How to modify a piece of code

Source: Internet
Author: User
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;
}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.