can I use fread to access WP remotely?
-
I have WP installed in a subdirectory and would like to access it from the home page of the site (just to get a summary of the latest posts).
I have been trying to use
fread
to access a php file in the WP subdirectory hoping that it would be executed there and just the output would be read onto the home page. But so far i have been getting errors.code on home page:
<?php
$summary_scr = fopen("https://www.star-channel.net/news/wp-content/themes/star/summary.php", "r");
$summary = fread($summary_scr, 200000);
fclose($summary_scr);
print $summary;
?>error message on site:
Fatal error: Call to undefined function: have_posts() in /home/star/public_html/news/wp-content/themes/star/summary.php on line 2
Ought I be doing something to allow fopen to use a URL as the parameter?
Does WP not allow me to remotely access it?
Would I be better off bypassing WP and simply accessing the MySQL database from the home page?
Any views?
Rob
- The topic ‘can I use fread to access WP remotely?’ is closed to new replies.