Curl, how to change the country of origin

Asked

Viewed 200 times

2

I used Curl to automatically log into Facebook, but a few minutes later, I received a message saying that someone had accessed my United States, and for security reasons they asked if I did it..

So I believe that the Curl uses the server to access the URL I had set in curl_setopt, with that the server must be located there(USA)..

The question is, is there a way to fix this? I believe it’s something with headers HTTP, Anyway, thank you if you can open my mind a little to even tell me who knows a tutorial on how Curl works.

  • 1

    Try the following, I’ll leave as a comment because I don’t know if it would fit as an answer or solution to your case. Log in to facebook on the site, open the console (F12 - Chrome), go to the network tab, search for the main one (usually first from the list), enter the headers tab. Analyze the headers (request-headers) that are passed and try to mount the similar Curl. More information on using headers -> http://stackoverflow.com/questions/8115683/php-curl-custom-headers

  • Rafael, I’ll read more about your answer, thanks! Daniel, actually it’s about how to get around the situation, is that I asked a question and I already pulled one more, I’ll tidy up the post.

  • @Rafaelwithoeft, I read something, and I didn’t find anything with it. But I realized that facebook is based by IP to represent an approximate city, and the IP that Acessei yesterday was the server and he put as Unknown, I believe only taking a server from Brazil, or simply allowing the unknown IP(telling Facebook I was the one who stopped.). Thanks for the reply, I ended up reading more about request and response headers, it was helpful for me.

  • @Alexandrec.Caus is really already seen something about this ip handling, it would be even worse if the user had in his security settings the access lock for these strange requests or from an unknown computer...

1 answer

0

The only way to do this is by using PROXY, IP is the only thing that identifies the location of the access.

The CURL has support for PROXY in several ways, you can use for example:

curl_setopt($ch, CURLOPT_PROXY, $proxy);

The $proxy will have to have the value of the type:

[user:password@]ip[:port]

For example:

$proxy = 'usuario:[email protected]:8888'

Proxies can be purchased, their cost is extremely variable, depending on the location, connection quality and also the usage limit. You can acquire the server itself and use it as a proxy, using for example the Squid Proxy, which is software intended for proxy creation. As another option is to use the TOR, it can be used as proxy and is free, in this case the IP would be 127.0.0.1:9050, if you are running on the local machine, and you must configure the exit node to the destination you want in the settings.

This will do exactly:

Seu servidor (Nova Iorque) -> Seu proxy (São Paulo) -> Facebook

This way Facebook will recognize that the connection occurred in São Paulo, if São Paulo is close (or exactly) where you connect normally there will be no lock. : D

Browser other questions tagged

You are not signed in. Login or sign up in order to post.