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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.