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:
- Need help to create WordPress page that decodes a text file and publishes it in JSON format
- PHP/CSS: Shortcode won’t display correctly, and only displays in the head (before content)
- Offset with ajax load more posts duplicates
- Get posts by id using shortcode
- Shortcode’s output to use as other shortcode’s parameter
- Show products per shortcode
- Shortcode just with a php code
- 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
- wp_send_json erase last value
- Complex PHP for json_encode > how to handle/output right?
- Can’t get_users info by using json_encode
- WordPress Shortcode based on other shortcode
- Force ‘permanent’ post cache of shortcode results
- Short code into PHP
- How can i iterate through this shortcode array?
- Add two or multiple functions in WordPress Post or Page
- Shortcode Works for Logged in Users but Not Working for Guest
- Wrapping shortcode content in a span or link
- perform mathematical operation on shortcode
- AJAX Filter WHILE Loop not working WordPress
- Update same content in multiple posts at once?
- Shortcode in a $output statement
- Need help with PHP functions
- I want to use wordpress database in android app using json encode?
- Custom fields changes the formatting of metabox input
- Shortcode is not outputting all of the desired markup
- When using shortcode, content stops generating after the_content
- Formatting Shortcode to Display in Visual Mode
- PHP Shortcode – 500 error
- Use html tags in shortcode_atts, is it real?
- Run PHP Results inside WP Shortcode
- problem multisite with blog id
- How to pass parameter that ends up being part of a class name with wordpress shortcode
- Shortcode At top of Page – PHP 5.5 vs 5.4 – ob_start();
- Contact form field in wordpress menu
- Serializing URL via wp add_shortcode to auto select from option list onload
- php string inside shortcode does not work
- Create dynamic content from one WP page to multiple other pages
- Limit the number of successful logins
- Result from wp_send_json adds line feed
- Shortcodes (with a space) added to php Sample
- Setting pages for posts
- How to have Function of a plugin using global vars into a shortcode?
- Shortcode Display From WordPress Dashboard Page Without Using post_id
- On selecting shortcode generate selected shortcode table inside page editor worrdpress
- Search in particular category in wordpress
- Show contact 7 form in popup
- Do_shortcode on PHP file outside theme ALMOST works
- Using the same shortcode to show any table from the database
- Overwriting a Shortcode
- How can I put a custom field as the link of a button shortcode?
- Shortcoding with Divs
- Where to place PHP for shortcodes
- Custom field within shortcode
- How to wrap a text with shortcode into php file?
- PHP Widget and do_shortcode
- Problem using explode inside add_shortcode() callback funciton [closed]
- Custom Shortcode with Dynamic Button
- Shortcode not passing variable to included file
- WordPress format json in postmeta table
- Php inside the shortcode is getting commented
- How to post data to a word press site in case of a mobile app
- Whats wrong with my code? Need To add String to shortcode? [closed]
- My title is showing after the shortcode
- A next page function with shortcode?
- Shortcode to include PHP file, pass various parameters to include?
- Pass a PHP variable (loop-audio.php) to jQuery function (js/script.js)
- I am unable to fetch json data from wp_db
- using a shortcode in a hyperlink
- Shortcode for Visual Composer Grid fails turning string to integer
- Display Current Time using shortcode
- Set variable in javascript and using in my shortcode
- JSON Object Value Show Undefine
- How to create shortcode of this PHP code
- Force array to be a string [closed]
- Is there a better way to output HTML as a shortcode?
- 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
- Gutenberg – render_callback does not pass ToggleControl value on frontend
- How to enqueue structured data as file – jsonld file seems not to work
- Custom Navigation Bar JSON Syntax Error in JSON at Position 0
- HTTP 500 Error after Creating Shortcode
- Redirect loop upon installation of my plugin
- REST API custom endpoints for metaboxes
- why css file not link?how to create permalink?
- Custom plugin with shortcode not working
- How call WordPress shortcode inside function file
- Show Login Errors In WordPress/Elementor (Code “works”, but breaks site)
- How to edit a widget code?
- Shortcode Displays 2 times
- How to execute a shortcode within a custom field?
- WordPress Register Block with metadata
- Calling a function via a shortcode in javascript
- Adding a css class to the gallery
- Strip and print only the numbers found in current’s post excerpt (even if they are without space)
- Woocomerce custom add to cart button edit functionality [closed]