Jump to content

Execute another page from within function?


Jwest100

Recommended Posts

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?

}

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.