Example, php curl modifies website request headers, including useragent, header information, etc.
Code:
-
-
for ($i = 0; $i < 5; $i++) { - task();
- }
//Modify the access request header
- function task() {
- $url = "http://www.xxx.com/?fromuid=272539";
- $ip = "100.100.".rand(1, 255)." .".rand(1, 255);
- $headers = array("X-FORWARDED-FOR:$ip");
-
- $curl = curl_init($url);
- curl_setopt($curl, CURLOPT_HTTPHEADER, $headers) ;
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/4.0");
- $src = curl_exec($curl);
- curl_close($curl);
- }
- ?>
-
Copy code
|