简体   繁体   English

在php中发送标头请求而不重定向(回发URL)

[英]send header request without redirect in php (postback url)

just wondering if it's possibile to send header request without redirect in php? 只想知道是否可以在php中发送标题请求而无需重定向? like a postback url 像回发网址

for example i need to call an URL via php (like http://example.test/?x=xxx&y=yyy ) but after that it's called i don't want that the script is redirected to this link, i need that the url is called and the script continues execution normally. 例如,我需要通过php调用URL(例如http://example.test/?x = xxx&y = yyy ),但是在此之后,我不希望脚本重定向到此链接,因此我需要调用url,脚本继续正常执行。

    <?php

// do something

header( 'location: http://example.test/?x=xxx&y=yyy' );

// do something else

?>

If you don't want to redirect, no need to use that header redirect. 如果您不想重定向,则无需使用该标头重定向。 If you just want to call that url and still continue on your own page you can simply call it via 如果您只想调用该URL并继续在自己的页面上继续,则可以通过

file_get_contents('http://example.test/?x=xxx&y=yyy');

And oh if you want to display the contents you can use the return value of that function. 哦,如果您想显示内容,可以使用该函数的返回值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM