Use the HTTP API:
$http = wp_remote_get( 'https://en.wikipedia.org/w/api.php?action=query&titles=Test_article&prop=revisions&rvlimit=1&format=json' );
if ( ! $body = wp_remote_retrieve_body( $http ) )
return;
if ( ! $data = json_decode( $body, true ) )
return;
$date = new DateTime( $data['query']['pages']['746140638']['revisions'][0]['timestamp'] );
return $date->format( 'm-d-Y' );
Related Posts:
- How to manually fix the WordPress gallery code using PHP in functions.php?
- Encode text string being appended as query to URL [closed]
- Display a text message if the shortcode is not found?
- How to return a string that has a variable inside in a shortcode?
- Run shortcode at certain resolution
- Passing a shortcode attribute to a sub-function
- post meta value as shortcode parameter
- How to protect own PHP code from WordPress updates
- Audio tags around Mp3 URL in content
- Loading page template into shortcode
- How to add Shortcode (font awesome) in widget title?
- Wrap each shortcode in array to div
- Upload a json file in php [closed]
- Placing the_content inside shortcode not working
- How to send user data in json format to another server when user register on wordpress site in PHP
- Autogenerate shortcodes from an array of strings
- How to Insert Shortcodes into Theme?
- is_page “range” for if statement?
- How can I generate random numbers inside my shortcodes on each implementation?
- Shortcode API: How to get name that matched shortcode RegEx?
- Shortcode content filter?
- Custom Theme, Custom shortcode not working
- Why is file_get_contents returning page source?
- Plugin CSS not enqueing
- Different loop output every x posts in custom post type
- Showing content from one page on another
- Showing a different gallery in a seperate post
- Create own WordPress shortcode gallery
- Fetch post block/field data as JSON with WordPress API
- WordPress Shortcodes.. printf is outputting a random number… Can’t figure out WHY?
- Custom shortcode outputs plain text instead of HTML at top of post
- How to use wp_add_inline_style for custom CSS added via shortcode?
- Displaying recent posts on static page with template-part via shortcode
- PHP > Scheduled Tasks > Sending daily email with dynamic API variables
- Fetching instagram api not working on wordpress
- Excecuting php function in shortcode
- Returning data instead of echoing/printing
- List taxonomy term slugs within shortcode (do_shortcode)
- Create a WordPress shortcode using PHP [duplicate]
- do_action(), iFrame Gets Displayed Despite Password Protection [closed]
- Using Shortcode to Grab Archive Listing, Separate by Year
- List all blogs, but exclude the main site
- Shortcode to pull posts
- PHP code inside Shortcode
- Help Fallback (thumbnail)
- How to return a string that has a jQuery and Ajax inside in a shortcode?
- Action Hook Inside WordPress Plugin Shortcode
- How can I include the user id inside of a shortcode php output?
- PHP Helper Class to create shortcodes
- help with custom shortcode that stopped working
- how to get sentence values from wordpress shortcode parameter?
- Updating Metadata with Shortcode
- Sending simple variable on single page to WP JSON
- Create shortcode for metabox gallery
- Can’t pass var from php wp_ajax into ajax script : result undefined or null
- couldnt show short code atts in category
- Time Stamp In A WordPress Post Title That Does Not Keep Refreshing
- How can I edit the final HTML structure of the whole web page
- I am having an issue with this shortcode plugin.. Warning: Illegal string offset ‘title’
- Advanced Custom Forms PHP formatting for do_shortcode
- How to add a PHP scripts into WordPress
- overwrite wordpress gallery with custom gallery shortcode
- How can I create a shortcode from an html and php code written together
- How can i send id of the currently posted form data through json response in custom wordpress plugin?
- CPT in a shortcode
- PHP/CSS: Shortcode won’t display correctly, and only displays in the head (before content)
- Open/closed function [closed]
- What is wrong with this shortcode? to include external php file in WordPress posts
- Need to Echo A Url path to show on a wordpress page
- WordPress Shortcode based on other shortcode
- Force ‘permanent’ post cache of shortcode results
- Wrapping shortcode content in a span or link
- AJAX Filter WHILE Loop not working WordPress
- I want to use wordpress database in android app using json encode?
- Formatting Shortcode to Display in Visual Mode
- Use html tags in shortcode_atts, is it real?
- How to pass parameter that ends up being part of a class name with wordpress shortcode
- Contact form field in wordpress menu
- php string inside shortcode does not work
- Limit the number of successful logins
- Shortcodes (with a space) added to php Sample
- How to have Function of a plugin using global vars into a shortcode?
- Overwriting a Shortcode
- Where to place PHP for shortcodes
- How to wrap a text with shortcode into php file?
- PHP Widget and do_shortcode
- Shortcode not passing variable to included file
- WordPress format json in postmeta table
- A next page function with shortcode?
- using a shortcode in a hyperlink
- JSON Object Value Show Undefine
- How to create shortcode of this PHP code
- Force array to be a string [closed]
- get_body_params() is always empty in POST request
- WP Custom tables query
- Display total count of products in orders of a specific order status
- Display terms on product page with shotrcode
- Redirect loop upon installation of my plugin
- REST API custom endpoints for metaboxes
- Custom plugin with shortcode not working