I'm looking to crawl different URLs from different countries programatically through PHP so I can record where they go. This will be to check to make sure the links really go to where they should go to. (Not a dead link, ect.) The URL will automatically route me elsewhere if the specified country doesn't match so I'm looking for a VPN service with multiple countries that accepts requests from PHP. Something I can send simple requests to visit a URL and just tell me back the URLs it jumped through to get there and which URL it ended on.
I understand PHP doesn't care what IP I'm on but maybe there is a service out there that does this. Can anyone point me in the right direction of a service that works like that or maybe have a better solution for doing this? It can't be manual solution. It must be something that can work with code automatically.
Thanks!
I recommended to use any VPN service offering SOCKS-proxies or OpenVPN. Both options are well documеnted and don't require extraordinary skills or privileges to run.
Usually those services offer tons of ready to use configuration files, so you'll be able to easily switch exit gateway countries from your scripts.
The largest VPN provider is hidemyass.com, the list of alternatives you can google or find here: https://vpntips.com/hidemyass-alternatives/
Another option is to use TOR network and choose exit countries. Yes, it has such option: https://www.torproject.org/docs/faq.html.en#ChooseEntryExit .
But TOR is usually overloaded and will give you many false failures, timeouts and a full range of other connectivity troubles.
Related
My (Windows) computer is connected with OpenVPN to my VPN provider. That means that everything goes through it, alternatively using its proxies as well for a little bit of variation.
In many situations, I don't want it to go through the VPN (or any proxy) when making a request. For example, when I use PHP to log in to my bank. Or when all proxies/VPNs are blocked from downloading a file, or loading a webpage, etc., which happens frequently. But then I'm stuck, because to the best of my knowledge, there is no way to tell PHP to "bypass the VPN and use my home IP address directly".
I would like something like:
php_bypass_VPN();
/* make cURL requests here */
php_restore_VPN();
Is it possible at all? If not, why is this not a major problem for anyone else? Or is it? It has caused countless issues for me, and not just in PHP context. For example, I would want the buffering local Internet radio station to go through my normal IP address as well, but no software I've ever seen provides any means to "bypass VPN".
If the solution involves hacking the OS and/or installing a bunch of spyware, I'll not be happy. Please tell me there is some simple way to do this, such as:
shell_exec('somebinary bypassvpntemporarily');
That would be swell, although a cross-platform solution would be vastly preferred.
Most VPNs work in a way that they install a new network interface driver on your PC and make sure all traffic goes through it so it can encrypt it on the way out.
I guess you could try to go through a specific interface but I'm not sure that will overcome the VPN (heres how to get a specific interface how to bind raw socket to specific interface).
Other than that you could create your own driver...
I want to create a tracking platform but am in need of some advice. What it has to do is the following:
Someone visits a link e.g. http://click.track.com/redirect?campaign=1&partnet_id=2
When visiting this link a user get's redirect to e.g. http://google.com/?xx=xx
I'm going to use redis since it's really fast and considering the following two options since I have the knowledge to build it in that way.
PHP
NodeJS
I'm thinking that NodeJS is going to be faster but would like to know opinions of other people. Maybe I just have to learn something else to make it work even better :)
I would look into HAPI server - this is a BATTLE tested node server that gives you SO many options. Express may work too but i put my trust in the HAPI server stack. Plus they have alot of great add ons and plugins.
https://hapijs.com/
Redis is also a great key value store as well - Look into CASSANDRA too
http://cassandra.apache.org/
https://redis.io/
You need to have a good hosting service provider like digitalocean, amazon cloud etc. for faster redirection. PHP or NodeJS it doesn't matter much when you have a faster hosting.
I have several VPS' and want to use PHP or shell scripting to display the ping in ms from the client to the server(s) so the user may compare which server to connect to. What is the best way to do this?
Assuming you want this to be asynchronous (so it doesn't stop the whole page from loading) then you could wrap something up in an Ajax call and then have a server-side script perform a ping on the $_SERVER['REMOTE_ADDR'] (IP of the person visiting the site). As for performing the ping itself, you should just be able to wrap that up in a "system('ping ..." call.
Hope that helps!
Depending on how sophisticated you want to get with your networking, you might want to give anycast a shot. The premise is that you give the same IP address to the two different VPS servers in the two different locations. When the client tries to connect to your server using a DNS lookup, it will find the single IP address, and depending on the closer server (ergo, better pinging server) should pickup that client. Cloudflare does this, and they explain it in their blog. Although, this might be seen a using a cannon to kill a mosquito, but it seems to work and it might even work for you. Here's some data that shows that Anycast is not evil.
I've done a LOT of research on my following problem, but it all ends up pointing to Websockets which I can't use because my host doesn't allow command line or ssh. I've also tried the postMessage(data, targetDomain) technique, but that's not entirely where I want to go either.
Here's what I want to do:
Execute javascript from one person to the other users that are on that page without reloading it or anything.
Example: A user clicks a button on the page and it sends a javascript code that automatically executes a function on every other listeners page. Kind of like a chat feature you could say, but less dense maybe?
This is my first time exploring this field so I'm a bit confused over the concepts. I've read multiple documentations of programs that offer socket like usage, but not really any luck here. (Like I said, I can't really use sockets because of my host).
Any help is appreciated, thanks!
If you are on a hosting platform that doesn't allow WebSockets then you can outsource the realtime communications layer to a hosted realtime service (I work for Pusher which is one such service).
Hosted services tend to have a free tier so depending on what you are trying to achieve that may be enough. If not, then contact them, explain your app and your situation and they may be able to help.
If you want to use a self hosted solution then you may need to go with something HTTP-based. But, again, if you are on a small shared hosting platform this may be quite resource intensive and your hosting provide may tell you off.
If updates aren't all that frequent they you could use standard AJAX polling at reasonably long intervals. It sounds like you'd like to avoid this though.
Personally, I'd recommend using a hosted service as what you are trying to achieve is inherently difficult with PHP as it was built with request/response in mind.
Related: Realtime websocket-like behavior possible on Heroku?
Apologize if this particular problem has been answered already (a search didn't turn anything directly relevant up).
We are developers of a web app that is used to provide community commenting and "social" to our partners websites. Our app uses Javascript and HTML on the front end, PHP and mySQL on the back.
Currently we are running everything through our own servers, which is getting very expensive.
We would like to ask our partners if we can host the app through their servers, with them getting a discount to our monthly charge due to the bandwidth/cpu load they would help us share.
My question is, is there a way to host our app through our partner's web servers in such a way that we can offload most of the CPU time and bandwidth without exposing our source code?
I would greatly appreciate any ideas/help!!
Thank you very much all!
If you also serve static or rarely changing content your clients could run a caching reverse proxy to remove some load from your servers without giving them any source code at all. But you need to implement caching headers for this to work properly.
You may want to look into nginx.
On second thought: Did you try to compile your scripts using facebooks Hip-Hop for PHP? First of all the script should perform way better, second of all, if you still had to outsource the hosting, you deploy a compiled program, no source code involved.
If you put the code on their server they can find out. So that won't be 100% working. Though you can make it difficult but it's still not great.
Most doable solution might be to separate parts of the application and share them. So: You give away a process (so source and other needed data) but it's only part of the total. That way no partner has your total solution but you do outsource the parts.