Z
Z
Zimaell2018-03-20 18:49:11
PHP
Zimaell, 2018-03-20 18:49:11

How to hide ip when making a request via CURL (PHP)?

Good day to all.
Tell me, is it possible to somehow mask the ip when requesting via CURL (PHP)?
Interested mainly in whether it is possible to disguise without using a proxy?
Maybe change the header or something like that.
Well, if it’s not possible, is it possible to use some kind of permanent proxy when making a request, preferably of course free ones, I’m also interested in whether it is possible to make a request through the tor server.

In general, as you understand, I'm looking for a way to make a request via CURL by masking ip, tell me who knows in this question.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
devalone, 2018-03-20
@devalone

Interested mainly in whether it is possible to disguise without using a proxy?

In order for the packet to return, you need to send it through some kind of gateway that knows who to return it to, it can be a proxy, vpn, or some other tunnel, even ssh.
you can change X-Forwarded-For and some incorrectly written web applications will take into account this particular IP, but this is rather an exception, usually this bug is shoved into CTFs, but in practice I have never met
Yes, there are sites that provide such proxies, and I have a program for collecting proxies for such sites https://github.com/DevAlone/proxy_py many proxies die, but there are those that work stably, the most reliable has been working for 42 days .
Yes, install tor `sudo apt install tor` on ubuntu, run `sudo service tor start` and use it as a socks proxy with the address `localhost:9050`, the address can be changed in the settings, you can also raise several such proxies and each will have your IP address.

K
Kirill Gorelov, 2018-03-20
@Kirill-Gorelov

https://gist.github.com/Kirill-Gorelov/
HERE I write down my developments on working with curl.
It can be useful.
But specifically what you need, see line 55 to 85.
I have an example of downloading a file there, but it's easy to convert it to any other.
But this is to work through a proxy. The proxy as mentioned above is hidemy.
I even had a bunch of hidemy + my curl somewhere, but I don’t remember where.

F
frees2, 2018-03-21
@frees2

It is really possible and it works through curl (one, then the second request ..), for example, to get YouTube videos, first we get one title, then another from the list ... Google is struggling with this. This cold war has been going on for a long time.
It is necessary to look for an example of a script, everything is painted there.

M
Mikka, 2019-10-02
@Horny_515

Provided that the Tor is up and running
The first file is called "cURL.php"
We write in it
<?php
//Create a function that accepts a link, and 2 arrays
function curl_get($url, $referer, $useragent)
{
$ch = curl_init ();
//Set proxy torus
curl_setopt($ch, CURLOPT_PROXY, 'socks5://127.0.0.1:9050');
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
//Disguise custom by choosing a system
curl_setopt($ch, CURLOPT_USERAGENT, $useragent[array_rand($useragent, 1)]);
// We mask ourselves by custom substituting the search system from which we would have come
curl_setopt($ch, CURLOPT_REFERER, $referer[array_rand($referer, 1)]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
?> Name
the second file somehow and write to it
<?php
include_once('cURL.php');
//Array of system+browser substitutions (There are sites on the net where this stuff is in bulk)
$useragent_array = [
'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0',
'Mozilla/5.0 (X11 ; U; Linux Core i7-4980HQ; de; rv:32.0; compatible; JobboerseBot; https://www.jobboerse.com/bot.htm) Gecko/20100101 Firefox/38.0',
'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0',
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0',
'Mozilla /5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0',
'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox /1.0.6',
'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0',
'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:58.0) Gecko/20100101 Firefox /58.0',
'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:57.0) Gecko/20100101 Firefox/57.0',
'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0 ',
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0',
'Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0',
'Mozilla/5.0 (Windows NT 5.1; rv:6.0.2) Gecko/20100101 Firefox/6.0.2',
'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:63.0) Gecko/20100101 Firefox/63.0',
'Mozilla/5.0 (Windows NT 5.1; rv:29.0) Gecko/20100101 Firefox/29.0',
'Mozilla/4.0 (compatible ; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)'];
//Array of search engines from which we would have come
$referer_array = [
' https://yandex.ru/ ',
' https://www.google.com/ ',
' https://www.google.com / ',
' https://www.rambler.ru/ ',
'',
' https://www.bing.com/ '];
//Start downloading page code into $html variable $
html = curl_get(' http:// target address', $referer_array, $useragent_array);
?>
In general, there is still a lot of things you need for good - check access, change SP, etc. Well, I wrote a piece of the basics.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question