Jwest100 Posted April 26, 2018 Share Posted April 26, 2018 I have this function in a php file (isolated for clarity): function new_post_notify($ID, $post){ if ( $post->post_date != $post->post_modified ){ //THIS IS A POST UPDATE, DO NOTHING } else { $title = $post->post_title; $permalink = get_permalink( $ID ); } ➡️ HOW DO I EXECUTE— another_file.php?title=$title&permalink=$permalink —AT THIS POINT IN THE FUNCTION? } Quote Link to comment Share on other sites More sharing options...
phpmillion Posted April 26, 2018 Share Posted April 26, 2018 Just make a curl request to it. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted April 26, 2018 Share Posted April 26, 2018 The question is: Do you wish to complete leave the current script to go do something else or do you want a return from the external script? The CURL request will do the latter. A header() call will do the former - if you haven't yet output anything form the currently running script. Quote Link to comment Share on other sites More sharing options...
requinix Posted April 26, 2018 Share Posted April 26, 2018 If you think the answer is to cURL it then first try not to. It's like a full web request and will contribute to the load on your server which means fewer resources will be able to serve actual users. If that page has code you want to trigger then copy the code, or move it into a function and call the function, or do something like that where you execute it directly. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.