Last active
March 10, 2022 13:05
-
-
Save danielcharrua/25f04d9231e29c216c6ee8f14595fef0 to your computer and use it in GitHub Desktop.
Test WordPress sitehealth loopback
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // | |
| // A very simple PHP example that sends a HTTP POST to a remote site | |
| // Put this file in your project root directory and execute in browser | |
| // If you see an error, probably the Loopback on Site Health will be also failing, solve this and test again. | |
| // | |
| $ch = curl_init(); | |
| curl_setopt($ch, CURLOPT_URL,"http://meninos.org/wp-cron.php"); | |
| curl_setopt($ch, CURLOPT_POST, 1); | |
| curl_setopt($ch, CURLOPT_POSTFIELDS, "postvar1=value1&postvar2=value2&postvar3=value3"); | |
| // In real life you should use something like: | |
| // curl_setopt($ch, CURLOPT_POSTFIELDS, | |
| // http_build_query(array('postvar1' => 'value1'))); | |
| // Receive server response ... | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
| $server_output = curl_exec($ch); | |
| // Check for errors | |
| if (curl_errno($ch)) { | |
| $error_msg = curl_error($ch); | |
| } | |
| curl_close ($ch); | |
| // Further processing ... | |
| if ($server_output == "OK") { | |
| echo 'OK'; | |
| } else { | |
| echo 'error'; | |
| var_dump($error_msg); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment