To make this work with WordPress use the AJAX API. While that technically refers to Javascript it will handle any request if the appropriate values are sent.
You would create a callback like this one form the Codex:
add_action('wp_ajax_my_action', 'my_action_callback');
function my_action_callback() {
global $wpdb; // this is how you get access to the database
$whatever = intval( $_POST['whatever'] );
$whatever += 10;
echo $whatever;
die(); // this is required to return a proper result
}
Then send a POST
request with the my_action
argument set. Notice how that is hook name wp_ajax_my_action
minus wp_ajax_
. You will need to use wp_ajax_nopriv_my_action
for users that are not logged– presumably your cURL
script isn’t logged in.
To display the cURL
content…
-
Create a page template to display your
cURL
. It should look
something like:/* Template Name: cURL Content */ // code for your curl data // no other code at all
- Go to the backend to
wp-admin->Pages
and create a page. Select the
template you created as the “Template”
Done. That page should display only your cURL
data. It will have no internal WordPress functionality, though, as far as script or style loading, and a number of other things, because you are not including wp_head
and wp_footer
.