Jump to content

PHP and WORDPRESS


chupacabrot

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.