Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am trying to access selected post information from my WordPress database to display on a second website which is not a WordPress site nor is it php, it is in fact an asp.net website that i want to display the information on.

I have a WordPress blog at blog.domain.com and another website at domain.com both running on different servers and I need to display the excerpt, title with link on my asp.net website for selected posts. I can easily grab the excerpt and title from the blog's database but the only problem is that the permalink is not in the database.

I had the idea that maybe if I place a short piece of code on every blog to insert the permalink to a new table, i could then grab that to use over on the other website. But that didnt work, perhaps I am not doing it right. This is the code I used and I placed this within the loop on the template file for the page I was testing on.

<?php 
  global $wpdb; 
  $table_name = $wpdb->prefix . "posts_pages_url"; 
  $wpdb->insert($table_name , array('post_id' => get_the_ID(), 'url' => get_permalink())); 
?>

I would be very grateful if anyone had any suggestions on how I can access the permalink via a database call.

Many thanks

share|improve this question
    
Had you considered implementing this via Ajax call to your WP installation instead? Permalink are not stored in database precisely because it is troublesome approach. :) –  Rarst Aug 26 '12 at 13:01
add comment

1 Answer

Instead of getting stuff from the database, access the site via its feed.

http://example.com/?p=POST-ID&feed=rss2 will give you information about the post, including the permalink (in the <link> tag).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.