chupacabrot Posted January 23, 2014 Share Posted January 23, 2014 Hello, Is there any way to -remotely- insert a post to a custom wordpress URL? Assuming I have a network of 5 websites and i would like to update all of them through some form i'll build (may say - a mini CMS maybe). Site 1 - [Form for content] [submit button] Site 2 - [Form2 for content] [[submit button]] Site 3 - [Form3 for content] [submit button] ... and so on. And simply everytime i'll pust the submit button the Form3 content will go to a specific wordpress website, and same about Form2 and Form1. Thanks. Link to comment https://forums.phpfreaks.com/topic/285606-php-and-wordpress/ Share on other sites More sharing options...
trq Posted January 23, 2014 Share Posted January 23, 2014 Of course there is a way, where are you stuck? Link to comment https://forums.phpfreaks.com/topic/285606-php-and-wordpress/#findComment-1466270 Share on other sites More sharing options...
chupacabrot Posted January 23, 2014 Author Share Posted January 23, 2014 Conceptually i'm stuck (: I know i can insert post with wp_insert_post when im already in this blog - but how can i make it remotely? do i actually need to open multiple mysql connection to each wordpress database and then insert the posts? Link to comment https://forums.phpfreaks.com/topic/285606-php-and-wordpress/#findComment-1466276 Share on other sites More sharing options...
chupacabrot Posted January 23, 2014 Author Share Posted January 23, 2014 I mean, every 'submit' button will respectively send a $_POST request to some other .php file that connects to a specific database of the desired wordpress and will use wp_insert_post there with the data that sent over the POST method? Link to comment https://forums.phpfreaks.com/topic/285606-php-and-wordpress/#findComment-1466307 Share on other sites More sharing options...
chupacabrot Posted January 23, 2014 Author Share Posted January 23, 2014 Assume that $bandList is an array of strings , and i want to create a page with the whole list - function createWPpage($bandlist) { $link = mysql_connect("localhost","root","pass","wordpress"); if(!link) { die('Could not connect: ' . mysql_error()); } $sql = 'INSERT INTO wp_posts '. '(post_content,post_title,post_type) '. 'VALUES {'$bandlist','List of Bands','page'}'; mysql_select_db('wordpress'); $retval = mysql_query( $sql, $conn ); if(! $retval ) { die('Could not enter data: ' . mysql_error()); } echo "Entered data successfully\n"; mysql_close($conn); } Well, I got wordpress installed on localhost but for some reason it wont show any error or warning while trying to execute this code (turned E_ALL on) but on the other hand - it doesn't make any changes to the actual database.. am I missing something? Link to comment https://forums.phpfreaks.com/topic/285606-php-and-wordpress/#findComment-1466311 Share on other sites More sharing options...
chupacabrot Posted January 24, 2014 Author Share Posted January 24, 2014 Anyone? Please? Link to comment https://forums.phpfreaks.com/topic/285606-php-and-wordpress/#findComment-1466370 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.