If you want to get the content,file info from a remote file for use it in wordpress instal then follow the step describe below.
Use the wp_remote_get() function (Or wp_remote_post() is you prefer using the POST method) to retrieve the desired url. The following example describe how to retrieve an url and display its content as well as the file info.
This code can be used anywhere on your template files.
$response = wp_remote_get( 'http://sandipdas.in/file.txt' );
if( is_wp_error( $response ) ) {
echo 'Something went wrong!';
} else {
echo 'Response:';
print_r( $response );
';
}
No comments:
Post a Comment