stijnvb Posted February 12, 2011 Share Posted February 12, 2011 I would like to use an external API, and access it with my 2nd IP address of the server. Is this possible? And if so, how? Example: primary ip: 4.5.6.7 secondary ip: 4.5.6.8 primary ip is used to host several websites the PHP script I made runs in CLI, I want it to access the external API from my secondary ip. Thanks! Link to comment https://forums.phpfreaks.com/topic/227489-using-a-different-local-ip-to-run-apis/ Share on other sites More sharing options...
Fergal Andrews Posted February 13, 2011 Share Posted February 13, 2011 Hi stijnvb, I've never done this myself but I think you can achieve what you are looking for by utilising PHP's socket functons. Have a look in the manual at "Socket" and "fsockopen()" in particular. Cheers, Fergal Link to comment https://forums.phpfreaks.com/topic/227489-using-a-different-local-ip-to-run-apis/#findComment-1173521 Share on other sites More sharing options...
stijnvb Posted February 13, 2011 Author Share Posted February 13, 2011 Hi stijnvb, I've never done this myself but I think you can achieve what you are looking for by utilising PHP's socket functons. Have a look in the manual at "Socket" and "fsockopen()" in particular. Cheers, Fergal Thanks for the tip. I'm not sure why I didn't think of it sooner, but I just used cURL, as I stated in an earlier post ... i was using a class provided by the API provider, and did not really bother looking into it. Problem solved :-) Thanks for the help! Link to comment https://forums.phpfreaks.com/topic/227489-using-a-different-local-ip-to-run-apis/#findComment-1173534 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.