简体   繁体   中英

send header request without redirect in php (postback url)

just wondering if it's possibile to send header request without redirect in 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

// 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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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