How can I redirect user to API endpoint (different domain) using server IP instead of user IP?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I'm doing a soap request to an external API using Laravel & Guzzle. All other calls have succeeded to get the actual response but for the redirecting user to the external page has failed because the external API web service only allows my server IP to access that page.



I have tried:



  1. windows.location (javascript)

  2. location header (PHP)

  3. return redirect URL (PHP)

This is their documentation on how to redirect in VB language :
redirection code in VB



All of these methods only use the browser redirection which is using user IP not the server IP.



Any method that I can use to redirect user using my server IP that you guys can recommend?



Thanks in advance.



Extra context/information:



Example screenshot for the fourth call which include get the quotation number and generate the url parameter



That is the code for VB that they provided in API documentation. So why I want to bring the user to the page? It is because when the GetQuotation (fourth call) is already submitted to their database and it will return QuoNo that will be used in the URL parameter. When the user gets redirected to the external page with parameter QuoNo=12412194149124, their backend will query for the quotation details that the user fills in my side (mydomain.com/form) and auto filled it on their side (otherdomain.com/form).



If you see from the screenshot, the System.Diagnostics.Process.Start will execute the url once the Quotation number (QuoNo) is generated. So once the user click on the 'buy now' button on our end (mydomain.com/form), it will call the fourth call (GetQuotation guzzle function) and generate a Quotation Number (QuoNo) then it will be populated in http://otherdomain.com/main.a5w?tokenid=wm-9Kj-14e-Fa4-I1adlXrQ00weqwe3S&QuoNo=QUO022348921312301623. Based on what my understanding on VB code, System.Diagnostics.Process.Start will force the url to be opened.



I'm sorry if it's still lacked of info given. Feel free to ask more. Thank you










share|improve this question
























  • What is viewed on this page? I.e. can the user do specific actions on this page or is it just a message to the user?

    – Sven Hakvoort
    Nov 14 '18 at 11:25











  • So from my endpoint page (mydomain.com/form) will send the user data to the external page (otherdomain.com/form). On the external page (otherdomain.com/form) already injected with form details that user filled up from my end (mydomain.com/form). The external API webservice only allow my server IP to be accessing the external page (otherdomain.com/form) so I can't use redirect (status 301) for that because it will use user IP instead of server IP.

    – Muhd Adrin
    Nov 14 '18 at 11:52











  • Since you mention that is is an API I assume that a request is send to the other server to perform an action based on the form data which does not require any action from the user?

    – Sven Hakvoort
    Nov 14 '18 at 11:57











  • Yeah, it's a request that processed from the backend (I'm using guzzle PHP for that). For other four API calls, I have succeeded get the response. For now, I need to know how to make a request (for redirection) based on when a user click a button then send the request to the backend to bring the user to the external page.

    – Muhd Adrin
    Nov 14 '18 at 12:03











  • The best way for this would be to use guzzle to post the form data to otherdomain.com/form, get the response of this and then return it to the user. Other work arounds will get very complicated/inefficient because you would have to scrape the page of otherdomain, return that in your own domain and so forth. But I am not sure if this could work for you?

    – Sven Hakvoort
    Nov 14 '18 at 12:09

















0















I'm doing a soap request to an external API using Laravel & Guzzle. All other calls have succeeded to get the actual response but for the redirecting user to the external page has failed because the external API web service only allows my server IP to access that page.



I have tried:



  1. windows.location (javascript)

  2. location header (PHP)

  3. return redirect URL (PHP)

This is their documentation on how to redirect in VB language :
redirection code in VB



All of these methods only use the browser redirection which is using user IP not the server IP.



Any method that I can use to redirect user using my server IP that you guys can recommend?



Thanks in advance.



Extra context/information:



Example screenshot for the fourth call which include get the quotation number and generate the url parameter



That is the code for VB that they provided in API documentation. So why I want to bring the user to the page? It is because when the GetQuotation (fourth call) is already submitted to their database and it will return QuoNo that will be used in the URL parameter. When the user gets redirected to the external page with parameter QuoNo=12412194149124, their backend will query for the quotation details that the user fills in my side (mydomain.com/form) and auto filled it on their side (otherdomain.com/form).



If you see from the screenshot, the System.Diagnostics.Process.Start will execute the url once the Quotation number (QuoNo) is generated. So once the user click on the 'buy now' button on our end (mydomain.com/form), it will call the fourth call (GetQuotation guzzle function) and generate a Quotation Number (QuoNo) then it will be populated in http://otherdomain.com/main.a5w?tokenid=wm-9Kj-14e-Fa4-I1adlXrQ00weqwe3S&QuoNo=QUO022348921312301623. Based on what my understanding on VB code, System.Diagnostics.Process.Start will force the url to be opened.



I'm sorry if it's still lacked of info given. Feel free to ask more. Thank you










share|improve this question
























  • What is viewed on this page? I.e. can the user do specific actions on this page or is it just a message to the user?

    – Sven Hakvoort
    Nov 14 '18 at 11:25











  • So from my endpoint page (mydomain.com/form) will send the user data to the external page (otherdomain.com/form). On the external page (otherdomain.com/form) already injected with form details that user filled up from my end (mydomain.com/form). The external API webservice only allow my server IP to be accessing the external page (otherdomain.com/form) so I can't use redirect (status 301) for that because it will use user IP instead of server IP.

    – Muhd Adrin
    Nov 14 '18 at 11:52











  • Since you mention that is is an API I assume that a request is send to the other server to perform an action based on the form data which does not require any action from the user?

    – Sven Hakvoort
    Nov 14 '18 at 11:57











  • Yeah, it's a request that processed from the backend (I'm using guzzle PHP for that). For other four API calls, I have succeeded get the response. For now, I need to know how to make a request (for redirection) based on when a user click a button then send the request to the backend to bring the user to the external page.

    – Muhd Adrin
    Nov 14 '18 at 12:03











  • The best way for this would be to use guzzle to post the form data to otherdomain.com/form, get the response of this and then return it to the user. Other work arounds will get very complicated/inefficient because you would have to scrape the page of otherdomain, return that in your own domain and so forth. But I am not sure if this could work for you?

    – Sven Hakvoort
    Nov 14 '18 at 12:09













0












0








0








I'm doing a soap request to an external API using Laravel & Guzzle. All other calls have succeeded to get the actual response but for the redirecting user to the external page has failed because the external API web service only allows my server IP to access that page.



I have tried:



  1. windows.location (javascript)

  2. location header (PHP)

  3. return redirect URL (PHP)

This is their documentation on how to redirect in VB language :
redirection code in VB



All of these methods only use the browser redirection which is using user IP not the server IP.



Any method that I can use to redirect user using my server IP that you guys can recommend?



Thanks in advance.



Extra context/information:



Example screenshot for the fourth call which include get the quotation number and generate the url parameter



That is the code for VB that they provided in API documentation. So why I want to bring the user to the page? It is because when the GetQuotation (fourth call) is already submitted to their database and it will return QuoNo that will be used in the URL parameter. When the user gets redirected to the external page with parameter QuoNo=12412194149124, their backend will query for the quotation details that the user fills in my side (mydomain.com/form) and auto filled it on their side (otherdomain.com/form).



If you see from the screenshot, the System.Diagnostics.Process.Start will execute the url once the Quotation number (QuoNo) is generated. So once the user click on the 'buy now' button on our end (mydomain.com/form), it will call the fourth call (GetQuotation guzzle function) and generate a Quotation Number (QuoNo) then it will be populated in http://otherdomain.com/main.a5w?tokenid=wm-9Kj-14e-Fa4-I1adlXrQ00weqwe3S&QuoNo=QUO022348921312301623. Based on what my understanding on VB code, System.Diagnostics.Process.Start will force the url to be opened.



I'm sorry if it's still lacked of info given. Feel free to ask more. Thank you










share|improve this question
















I'm doing a soap request to an external API using Laravel & Guzzle. All other calls have succeeded to get the actual response but for the redirecting user to the external page has failed because the external API web service only allows my server IP to access that page.



I have tried:



  1. windows.location (javascript)

  2. location header (PHP)

  3. return redirect URL (PHP)

This is their documentation on how to redirect in VB language :
redirection code in VB



All of these methods only use the browser redirection which is using user IP not the server IP.



Any method that I can use to redirect user using my server IP that you guys can recommend?



Thanks in advance.



Extra context/information:



Example screenshot for the fourth call which include get the quotation number and generate the url parameter



That is the code for VB that they provided in API documentation. So why I want to bring the user to the page? It is because when the GetQuotation (fourth call) is already submitted to their database and it will return QuoNo that will be used in the URL parameter. When the user gets redirected to the external page with parameter QuoNo=12412194149124, their backend will query for the quotation details that the user fills in my side (mydomain.com/form) and auto filled it on their side (otherdomain.com/form).



If you see from the screenshot, the System.Diagnostics.Process.Start will execute the url once the Quotation number (QuoNo) is generated. So once the user click on the 'buy now' button on our end (mydomain.com/form), it will call the fourth call (GetQuotation guzzle function) and generate a Quotation Number (QuoNo) then it will be populated in http://otherdomain.com/main.a5w?tokenid=wm-9Kj-14e-Fa4-I1adlXrQ00weqwe3S&QuoNo=QUO022348921312301623. Based on what my understanding on VB code, System.Diagnostics.Process.Start will force the url to be opened.



I'm sorry if it's still lacked of info given. Feel free to ask more. Thank you







php laravel soap guzzle http-redirect






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 '18 at 15:32









Sven Hakvoort

2,2402724




2,2402724










asked Nov 14 '18 at 11:24









Muhd AdrinMuhd Adrin

33




33












  • What is viewed on this page? I.e. can the user do specific actions on this page or is it just a message to the user?

    – Sven Hakvoort
    Nov 14 '18 at 11:25











  • So from my endpoint page (mydomain.com/form) will send the user data to the external page (otherdomain.com/form). On the external page (otherdomain.com/form) already injected with form details that user filled up from my end (mydomain.com/form). The external API webservice only allow my server IP to be accessing the external page (otherdomain.com/form) so I can't use redirect (status 301) for that because it will use user IP instead of server IP.

    – Muhd Adrin
    Nov 14 '18 at 11:52











  • Since you mention that is is an API I assume that a request is send to the other server to perform an action based on the form data which does not require any action from the user?

    – Sven Hakvoort
    Nov 14 '18 at 11:57











  • Yeah, it's a request that processed from the backend (I'm using guzzle PHP for that). For other four API calls, I have succeeded get the response. For now, I need to know how to make a request (for redirection) based on when a user click a button then send the request to the backend to bring the user to the external page.

    – Muhd Adrin
    Nov 14 '18 at 12:03











  • The best way for this would be to use guzzle to post the form data to otherdomain.com/form, get the response of this and then return it to the user. Other work arounds will get very complicated/inefficient because you would have to scrape the page of otherdomain, return that in your own domain and so forth. But I am not sure if this could work for you?

    – Sven Hakvoort
    Nov 14 '18 at 12:09

















  • What is viewed on this page? I.e. can the user do specific actions on this page or is it just a message to the user?

    – Sven Hakvoort
    Nov 14 '18 at 11:25











  • So from my endpoint page (mydomain.com/form) will send the user data to the external page (otherdomain.com/form). On the external page (otherdomain.com/form) already injected with form details that user filled up from my end (mydomain.com/form). The external API webservice only allow my server IP to be accessing the external page (otherdomain.com/form) so I can't use redirect (status 301) for that because it will use user IP instead of server IP.

    – Muhd Adrin
    Nov 14 '18 at 11:52











  • Since you mention that is is an API I assume that a request is send to the other server to perform an action based on the form data which does not require any action from the user?

    – Sven Hakvoort
    Nov 14 '18 at 11:57











  • Yeah, it's a request that processed from the backend (I'm using guzzle PHP for that). For other four API calls, I have succeeded get the response. For now, I need to know how to make a request (for redirection) based on when a user click a button then send the request to the backend to bring the user to the external page.

    – Muhd Adrin
    Nov 14 '18 at 12:03











  • The best way for this would be to use guzzle to post the form data to otherdomain.com/form, get the response of this and then return it to the user. Other work arounds will get very complicated/inefficient because you would have to scrape the page of otherdomain, return that in your own domain and so forth. But I am not sure if this could work for you?

    – Sven Hakvoort
    Nov 14 '18 at 12:09
















What is viewed on this page? I.e. can the user do specific actions on this page or is it just a message to the user?

– Sven Hakvoort
Nov 14 '18 at 11:25





What is viewed on this page? I.e. can the user do specific actions on this page or is it just a message to the user?

– Sven Hakvoort
Nov 14 '18 at 11:25













So from my endpoint page (mydomain.com/form) will send the user data to the external page (otherdomain.com/form). On the external page (otherdomain.com/form) already injected with form details that user filled up from my end (mydomain.com/form). The external API webservice only allow my server IP to be accessing the external page (otherdomain.com/form) so I can't use redirect (status 301) for that because it will use user IP instead of server IP.

– Muhd Adrin
Nov 14 '18 at 11:52





So from my endpoint page (mydomain.com/form) will send the user data to the external page (otherdomain.com/form). On the external page (otherdomain.com/form) already injected with form details that user filled up from my end (mydomain.com/form). The external API webservice only allow my server IP to be accessing the external page (otherdomain.com/form) so I can't use redirect (status 301) for that because it will use user IP instead of server IP.

– Muhd Adrin
Nov 14 '18 at 11:52













Since you mention that is is an API I assume that a request is send to the other server to perform an action based on the form data which does not require any action from the user?

– Sven Hakvoort
Nov 14 '18 at 11:57





Since you mention that is is an API I assume that a request is send to the other server to perform an action based on the form data which does not require any action from the user?

– Sven Hakvoort
Nov 14 '18 at 11:57













Yeah, it's a request that processed from the backend (I'm using guzzle PHP for that). For other four API calls, I have succeeded get the response. For now, I need to know how to make a request (for redirection) based on when a user click a button then send the request to the backend to bring the user to the external page.

– Muhd Adrin
Nov 14 '18 at 12:03





Yeah, it's a request that processed from the backend (I'm using guzzle PHP for that). For other four API calls, I have succeeded get the response. For now, I need to know how to make a request (for redirection) based on when a user click a button then send the request to the backend to bring the user to the external page.

– Muhd Adrin
Nov 14 '18 at 12:03













The best way for this would be to use guzzle to post the form data to otherdomain.com/form, get the response of this and then return it to the user. Other work arounds will get very complicated/inefficient because you would have to scrape the page of otherdomain, return that in your own domain and so forth. But I am not sure if this could work for you?

– Sven Hakvoort
Nov 14 '18 at 12:09





The best way for this would be to use guzzle to post the form data to otherdomain.com/form, get the response of this and then return it to the user. Other work arounds will get very complicated/inefficient because you would have to scrape the page of otherdomain, return that in your own domain and so forth. But I am not sure if this could work for you?

– Sven Hakvoort
Nov 14 '18 at 12:09












1 Answer
1






active

oldest

votes


















0














What you want can not be achieved sadly. The only thing you can do with the redirect is tell the browser where to go, you have no control over the IP here since this would pose all kinds of issues regarding security and identification. The only way to achieve what you want is to wrap the html of the resulting webpage in your website or remove the restriction of the ip addresses. Another solution could be to build a simple page which is accessible to everyone and limit the API routes to specific IP addresses. For example:



Let's assume the payment gateway is at: example.com/checkout, this one would be accessible to everyone and would contain a form to which you can perform the redirect and fill this form with the passed data.



This form would then post the information to example.com/api/v1/checkout which will process your form data and return if the transaction was succesful. Based on this return the user will be redirected to another page. This is assuming you have control over the other domain since only with your server IP you can access this site.



If this is not the case there is no other way than to post the data to an endpoint via guzzle and use these return values to provide feedback to the user.



I hope this answers your question, if anything is unclear please let me know.






share|improve this answer























  • I really appreciate what you try to make me understand by accessing the external page using my server IP is impossible because it will still use the browser to navigate user to the external page. I tried to scrape down the page to my end but the assets such as CSS,JS and images are located to their end so the page scraped output in blank on my end. I've researched System.Diagnostics.Process.Start (VB code) to be translated to PHP which is Program execution Functions. (php.net/manual/en/ref.exec.php). Do you think is it possible for me to code that instead of normal redirection?

    – Muhd Adrin
    Nov 14 '18 at 13:51












  • @MuhdAdrin, what would you want to use that for? Could you add an extra part in your question where you explain what you want to do with it and expected results?

    – Sven Hakvoort
    Nov 14 '18 at 14:31











  • Okay I'm sorry for not giving you much info. My website is an insurance aggregator. So basically there are 4 calls. The first one is getaccesstoken(success), second is getvehicleinfo(success), third is getprice(success) and the fourth is getquotation(success and i got the quotation number that will be attached on the url for redirection. e.g 203.xx.xx.xxx:8080/other/…). To access that url, I need to use my server IP to open the link for the user. Now I want to redirect user to the url once the button is clicked.

    – Muhd Adrin
    Nov 14 '18 at 14:40












  • @MuhdAdrin, it is still very unclear to me why you want to redirect the user to that domain when that domain only accepts incoming connections from your server. What information do they provide (could you provide an example/screenshot)? The command you mentiond looks very similair to file_get_contents(), the program execution functions will be executed server side and thus do not benefit the user, so I don't think you could get that to work

    – Sven Hakvoort
    Nov 14 '18 at 14:49











  • My answer is on the answer part if you didn’t get the notification. Thanks

    – Muhd Adrin
    Nov 14 '18 at 15:09











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53299089%2fhow-can-i-redirect-user-to-api-endpoint-different-domain-using-server-ip-inste%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














What you want can not be achieved sadly. The only thing you can do with the redirect is tell the browser where to go, you have no control over the IP here since this would pose all kinds of issues regarding security and identification. The only way to achieve what you want is to wrap the html of the resulting webpage in your website or remove the restriction of the ip addresses. Another solution could be to build a simple page which is accessible to everyone and limit the API routes to specific IP addresses. For example:



Let's assume the payment gateway is at: example.com/checkout, this one would be accessible to everyone and would contain a form to which you can perform the redirect and fill this form with the passed data.



This form would then post the information to example.com/api/v1/checkout which will process your form data and return if the transaction was succesful. Based on this return the user will be redirected to another page. This is assuming you have control over the other domain since only with your server IP you can access this site.



If this is not the case there is no other way than to post the data to an endpoint via guzzle and use these return values to provide feedback to the user.



I hope this answers your question, if anything is unclear please let me know.






share|improve this answer























  • I really appreciate what you try to make me understand by accessing the external page using my server IP is impossible because it will still use the browser to navigate user to the external page. I tried to scrape down the page to my end but the assets such as CSS,JS and images are located to their end so the page scraped output in blank on my end. I've researched System.Diagnostics.Process.Start (VB code) to be translated to PHP which is Program execution Functions. (php.net/manual/en/ref.exec.php). Do you think is it possible for me to code that instead of normal redirection?

    – Muhd Adrin
    Nov 14 '18 at 13:51












  • @MuhdAdrin, what would you want to use that for? Could you add an extra part in your question where you explain what you want to do with it and expected results?

    – Sven Hakvoort
    Nov 14 '18 at 14:31











  • Okay I'm sorry for not giving you much info. My website is an insurance aggregator. So basically there are 4 calls. The first one is getaccesstoken(success), second is getvehicleinfo(success), third is getprice(success) and the fourth is getquotation(success and i got the quotation number that will be attached on the url for redirection. e.g 203.xx.xx.xxx:8080/other/…). To access that url, I need to use my server IP to open the link for the user. Now I want to redirect user to the url once the button is clicked.

    – Muhd Adrin
    Nov 14 '18 at 14:40












  • @MuhdAdrin, it is still very unclear to me why you want to redirect the user to that domain when that domain only accepts incoming connections from your server. What information do they provide (could you provide an example/screenshot)? The command you mentiond looks very similair to file_get_contents(), the program execution functions will be executed server side and thus do not benefit the user, so I don't think you could get that to work

    – Sven Hakvoort
    Nov 14 '18 at 14:49











  • My answer is on the answer part if you didn’t get the notification. Thanks

    – Muhd Adrin
    Nov 14 '18 at 15:09















0














What you want can not be achieved sadly. The only thing you can do with the redirect is tell the browser where to go, you have no control over the IP here since this would pose all kinds of issues regarding security and identification. The only way to achieve what you want is to wrap the html of the resulting webpage in your website or remove the restriction of the ip addresses. Another solution could be to build a simple page which is accessible to everyone and limit the API routes to specific IP addresses. For example:



Let's assume the payment gateway is at: example.com/checkout, this one would be accessible to everyone and would contain a form to which you can perform the redirect and fill this form with the passed data.



This form would then post the information to example.com/api/v1/checkout which will process your form data and return if the transaction was succesful. Based on this return the user will be redirected to another page. This is assuming you have control over the other domain since only with your server IP you can access this site.



If this is not the case there is no other way than to post the data to an endpoint via guzzle and use these return values to provide feedback to the user.



I hope this answers your question, if anything is unclear please let me know.






share|improve this answer























  • I really appreciate what you try to make me understand by accessing the external page using my server IP is impossible because it will still use the browser to navigate user to the external page. I tried to scrape down the page to my end but the assets such as CSS,JS and images are located to their end so the page scraped output in blank on my end. I've researched System.Diagnostics.Process.Start (VB code) to be translated to PHP which is Program execution Functions. (php.net/manual/en/ref.exec.php). Do you think is it possible for me to code that instead of normal redirection?

    – Muhd Adrin
    Nov 14 '18 at 13:51












  • @MuhdAdrin, what would you want to use that for? Could you add an extra part in your question where you explain what you want to do with it and expected results?

    – Sven Hakvoort
    Nov 14 '18 at 14:31











  • Okay I'm sorry for not giving you much info. My website is an insurance aggregator. So basically there are 4 calls. The first one is getaccesstoken(success), second is getvehicleinfo(success), third is getprice(success) and the fourth is getquotation(success and i got the quotation number that will be attached on the url for redirection. e.g 203.xx.xx.xxx:8080/other/…). To access that url, I need to use my server IP to open the link for the user. Now I want to redirect user to the url once the button is clicked.

    – Muhd Adrin
    Nov 14 '18 at 14:40












  • @MuhdAdrin, it is still very unclear to me why you want to redirect the user to that domain when that domain only accepts incoming connections from your server. What information do they provide (could you provide an example/screenshot)? The command you mentiond looks very similair to file_get_contents(), the program execution functions will be executed server side and thus do not benefit the user, so I don't think you could get that to work

    – Sven Hakvoort
    Nov 14 '18 at 14:49











  • My answer is on the answer part if you didn’t get the notification. Thanks

    – Muhd Adrin
    Nov 14 '18 at 15:09













0












0








0







What you want can not be achieved sadly. The only thing you can do with the redirect is tell the browser where to go, you have no control over the IP here since this would pose all kinds of issues regarding security and identification. The only way to achieve what you want is to wrap the html of the resulting webpage in your website or remove the restriction of the ip addresses. Another solution could be to build a simple page which is accessible to everyone and limit the API routes to specific IP addresses. For example:



Let's assume the payment gateway is at: example.com/checkout, this one would be accessible to everyone and would contain a form to which you can perform the redirect and fill this form with the passed data.



This form would then post the information to example.com/api/v1/checkout which will process your form data and return if the transaction was succesful. Based on this return the user will be redirected to another page. This is assuming you have control over the other domain since only with your server IP you can access this site.



If this is not the case there is no other way than to post the data to an endpoint via guzzle and use these return values to provide feedback to the user.



I hope this answers your question, if anything is unclear please let me know.






share|improve this answer













What you want can not be achieved sadly. The only thing you can do with the redirect is tell the browser where to go, you have no control over the IP here since this would pose all kinds of issues regarding security and identification. The only way to achieve what you want is to wrap the html of the resulting webpage in your website or remove the restriction of the ip addresses. Another solution could be to build a simple page which is accessible to everyone and limit the API routes to specific IP addresses. For example:



Let's assume the payment gateway is at: example.com/checkout, this one would be accessible to everyone and would contain a form to which you can perform the redirect and fill this form with the passed data.



This form would then post the information to example.com/api/v1/checkout which will process your form data and return if the transaction was succesful. Based on this return the user will be redirected to another page. This is assuming you have control over the other domain since only with your server IP you can access this site.



If this is not the case there is no other way than to post the data to an endpoint via guzzle and use these return values to provide feedback to the user.



I hope this answers your question, if anything is unclear please let me know.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 14 '18 at 12:29









Sven HakvoortSven Hakvoort

2,2402724




2,2402724












  • I really appreciate what you try to make me understand by accessing the external page using my server IP is impossible because it will still use the browser to navigate user to the external page. I tried to scrape down the page to my end but the assets such as CSS,JS and images are located to their end so the page scraped output in blank on my end. I've researched System.Diagnostics.Process.Start (VB code) to be translated to PHP which is Program execution Functions. (php.net/manual/en/ref.exec.php). Do you think is it possible for me to code that instead of normal redirection?

    – Muhd Adrin
    Nov 14 '18 at 13:51












  • @MuhdAdrin, what would you want to use that for? Could you add an extra part in your question where you explain what you want to do with it and expected results?

    – Sven Hakvoort
    Nov 14 '18 at 14:31











  • Okay I'm sorry for not giving you much info. My website is an insurance aggregator. So basically there are 4 calls. The first one is getaccesstoken(success), second is getvehicleinfo(success), third is getprice(success) and the fourth is getquotation(success and i got the quotation number that will be attached on the url for redirection. e.g 203.xx.xx.xxx:8080/other/…). To access that url, I need to use my server IP to open the link for the user. Now I want to redirect user to the url once the button is clicked.

    – Muhd Adrin
    Nov 14 '18 at 14:40












  • @MuhdAdrin, it is still very unclear to me why you want to redirect the user to that domain when that domain only accepts incoming connections from your server. What information do they provide (could you provide an example/screenshot)? The command you mentiond looks very similair to file_get_contents(), the program execution functions will be executed server side and thus do not benefit the user, so I don't think you could get that to work

    – Sven Hakvoort
    Nov 14 '18 at 14:49











  • My answer is on the answer part if you didn’t get the notification. Thanks

    – Muhd Adrin
    Nov 14 '18 at 15:09

















  • I really appreciate what you try to make me understand by accessing the external page using my server IP is impossible because it will still use the browser to navigate user to the external page. I tried to scrape down the page to my end but the assets such as CSS,JS and images are located to their end so the page scraped output in blank on my end. I've researched System.Diagnostics.Process.Start (VB code) to be translated to PHP which is Program execution Functions. (php.net/manual/en/ref.exec.php). Do you think is it possible for me to code that instead of normal redirection?

    – Muhd Adrin
    Nov 14 '18 at 13:51












  • @MuhdAdrin, what would you want to use that for? Could you add an extra part in your question where you explain what you want to do with it and expected results?

    – Sven Hakvoort
    Nov 14 '18 at 14:31











  • Okay I'm sorry for not giving you much info. My website is an insurance aggregator. So basically there are 4 calls. The first one is getaccesstoken(success), second is getvehicleinfo(success), third is getprice(success) and the fourth is getquotation(success and i got the quotation number that will be attached on the url for redirection. e.g 203.xx.xx.xxx:8080/other/…). To access that url, I need to use my server IP to open the link for the user. Now I want to redirect user to the url once the button is clicked.

    – Muhd Adrin
    Nov 14 '18 at 14:40












  • @MuhdAdrin, it is still very unclear to me why you want to redirect the user to that domain when that domain only accepts incoming connections from your server. What information do they provide (could you provide an example/screenshot)? The command you mentiond looks very similair to file_get_contents(), the program execution functions will be executed server side and thus do not benefit the user, so I don't think you could get that to work

    – Sven Hakvoort
    Nov 14 '18 at 14:49











  • My answer is on the answer part if you didn’t get the notification. Thanks

    – Muhd Adrin
    Nov 14 '18 at 15:09
















I really appreciate what you try to make me understand by accessing the external page using my server IP is impossible because it will still use the browser to navigate user to the external page. I tried to scrape down the page to my end but the assets such as CSS,JS and images are located to their end so the page scraped output in blank on my end. I've researched System.Diagnostics.Process.Start (VB code) to be translated to PHP which is Program execution Functions. (php.net/manual/en/ref.exec.php). Do you think is it possible for me to code that instead of normal redirection?

– Muhd Adrin
Nov 14 '18 at 13:51






I really appreciate what you try to make me understand by accessing the external page using my server IP is impossible because it will still use the browser to navigate user to the external page. I tried to scrape down the page to my end but the assets such as CSS,JS and images are located to their end so the page scraped output in blank on my end. I've researched System.Diagnostics.Process.Start (VB code) to be translated to PHP which is Program execution Functions. (php.net/manual/en/ref.exec.php). Do you think is it possible for me to code that instead of normal redirection?

– Muhd Adrin
Nov 14 '18 at 13:51














@MuhdAdrin, what would you want to use that for? Could you add an extra part in your question where you explain what you want to do with it and expected results?

– Sven Hakvoort
Nov 14 '18 at 14:31





@MuhdAdrin, what would you want to use that for? Could you add an extra part in your question where you explain what you want to do with it and expected results?

– Sven Hakvoort
Nov 14 '18 at 14:31













Okay I'm sorry for not giving you much info. My website is an insurance aggregator. So basically there are 4 calls. The first one is getaccesstoken(success), second is getvehicleinfo(success), third is getprice(success) and the fourth is getquotation(success and i got the quotation number that will be attached on the url for redirection. e.g 203.xx.xx.xxx:8080/other/…). To access that url, I need to use my server IP to open the link for the user. Now I want to redirect user to the url once the button is clicked.

– Muhd Adrin
Nov 14 '18 at 14:40






Okay I'm sorry for not giving you much info. My website is an insurance aggregator. So basically there are 4 calls. The first one is getaccesstoken(success), second is getvehicleinfo(success), third is getprice(success) and the fourth is getquotation(success and i got the quotation number that will be attached on the url for redirection. e.g 203.xx.xx.xxx:8080/other/…). To access that url, I need to use my server IP to open the link for the user. Now I want to redirect user to the url once the button is clicked.

– Muhd Adrin
Nov 14 '18 at 14:40














@MuhdAdrin, it is still very unclear to me why you want to redirect the user to that domain when that domain only accepts incoming connections from your server. What information do they provide (could you provide an example/screenshot)? The command you mentiond looks very similair to file_get_contents(), the program execution functions will be executed server side and thus do not benefit the user, so I don't think you could get that to work

– Sven Hakvoort
Nov 14 '18 at 14:49





@MuhdAdrin, it is still very unclear to me why you want to redirect the user to that domain when that domain only accepts incoming connections from your server. What information do they provide (could you provide an example/screenshot)? The command you mentiond looks very similair to file_get_contents(), the program execution functions will be executed server side and thus do not benefit the user, so I don't think you could get that to work

– Sven Hakvoort
Nov 14 '18 at 14:49













My answer is on the answer part if you didn’t get the notification. Thanks

– Muhd Adrin
Nov 14 '18 at 15:09





My answer is on the answer part if you didn’t get the notification. Thanks

– Muhd Adrin
Nov 14 '18 at 15:09



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53299089%2fhow-can-i-redirect-user-to-api-endpoint-different-domain-using-server-ip-inste%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Crossroads (UK TV series)

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế