A community in which webmasters can ask for help with topics such as PHP coding , MySQL , IT jobs, web design, IT security.
Current location:homephp forumphp talk in 2008 yearSame server, same program but started once using one network card and after with another - page 1
User InfoPosts
Same server, same program but started once using one network card and after with another#1
I have a Linux server with multiple ips (so, multiple eth0, eth0:0, eth0:1 etc).
The script I'm trying to start is a php CLI script which is downloading stuff from an another server API, and I would like to change the IP based on different parameters. Once the script is started, I don't need anymore to change the ip OF THAT SPECIFIC script until his end.

Do you have any clue if it is possible to achieve it?
My other solution was to install Xen or OpenVZ and create N different VPS per each IP, but as you can see is definitely a PITA :-)

posted date: 2008-12-22 05:11:00


Re: Same server, same program but started once using one network card and after with another#2
I had made out the solution of this problem. click to view my topic...

hope that hepls.

posted date: 2008-12-22 05:11:01


Re: Same server, same program but started once using one network card and after with another#3
You don't specify how you connect to the other server, but with sockets you can try socket_bind.EDIT:With curl you can try curl_setopt.CURLOPT_INTERFACE The name of the outgoing network interface to use. This can be an interface name, an IP address or a host name.

posted date: 2008-12-22 05:27:00


Re: Same server, same program but started once using one network card and after with another#4
I know how to do it in C - you use bind() on your socket before you call connect(), and you bind to the IP address assigned to the desired interface, passing 0 for port. I don't know how to do it in PHP.

posted date: 2008-12-22 05:52:00


Re: Same server, same program but started once using one network card and after with another#5
like socket_bind? :P

posted date: 2008-12-22 06:10:00


Re: Same server, same program but started once using one network card and after with another#6
O my god, you saved my day :-) I'll test it right now

posted date: 2008-12-22 10:39:00


select page: « 1 »
Copyright ©2008-2017 www.momige.com, all rights reserved.