background image

foreach

 (

$curl

 

as

 

$k

 => 

$v

) {

if

 (curl_error(

$curl

[

$k

]) == "") {

if

 (

$k

 == 0) {

$fname

[

$k

] = 

strtolower

(

$name

 . '.' . 

pathinfo

(

$urls

[

$k

], PATHINFO_EXTENSION));

else

 {

$fname

[

$k

] = 

strtolower

(

$name

 . '_' . 

$k

 . '.' . 

pathinfo

(

$urls

[

$k

], PATHINFO_EXTENSION));

}

$text

[

$k

] = (string) curl_multi_getcontent(

$curl

[

$k

]);

$filedir

[

$k

] = 

$dir

.'/' . 

$fname

[

$k

];

if

 (

file_put_contents

(

$filedir

[

$k

], 

$text

[

$k

])) {

$filepath

[

$k

] = 

$path

 . 

$fname

[

$k

];

}
}
curl_multi_remove_handle(

$handle

$curl

[

$k

]);

curl_close(

$curl

[

$k

]);

}
curl_multi_close(

$handle

);

return

 

$filepath

;

}