Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Regular Coder
    Join Date
    Mar 2005
    Posts
    240
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Taking content from my blog (at blogger) and putting it on my site

    Hi there
    Just wondering if anyone of you know if it's possible (and where I can find the solution) to grab a few items from my blog and post it on the homepage of my website.

    For example, say I post a new blog post on my blog site, upload it, and then automatically it appears on my regular website...

    What I would like to do is grab the blog title, a few sentences from the post as well as the date and move that over to my site so that people can see it on my site and if they want to read more, they click on the link and be taken to the blog site...

    Let me know if this is not clear!

    Thanks

  • #2
    Regular Coder
    Join Date
    Jul 2007
    Posts
    571
    Thanks
    25
    Thanked 28 Times in 28 Posts
    Well what blog software are you using for your blog? Wordpress? blogger?

  • #3
    Regular Coder
    Join Date
    Mar 2005
    Posts
    240
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I'm posting directly to the blogger site... Here's my blog www.wine-wall.blogspot.com

  • #4
    Regular Coder
    Join Date
    Jul 2007
    Posts
    571
    Thanks
    25
    Thanked 28 Times in 28 Posts
    Ok I have never used blogger but I am guessing you should make a php code that will connect to your blogger database and and preform some quires to display what you want (ie: a few recent posts).

  • #5
    Regular Coder
    Join Date
    Mar 2005
    Posts
    240
    Thanks
    1
    Thanked 0 Times in 0 Posts
    So it's possible? Any idea on how to do this?

  • #6
    New Coder
    Join Date
    Nov 2007
    Posts
    72
    Thanks
    0
    Thanked 1 Time in 1 Post
    Most of the time, all you'd have to do is use a mysql_connect to get into their database and retrieve your blogs but you'd have to know the address of the database, a login and pass, and the id of your specific blogs in a database of probably hundreds of thousands of blogs.

    Your best bet is to try and find a way to load up an rss file of your blog. If it is an XML file, you can break it down using SimpleXML (look it up), and from there you can maybe display your blogs. Maybe.

    Good luck.

  • #7
    New Coder
    Join Date
    Nov 2007
    Location
    Kent, United Kingdom
    Posts
    67
    Thanks
    6
    Thanked 2 Times in 2 Posts
    i have a different idea.
    if you link me to your blog i'll create something that should work

  • #8
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,638
    Thanks
    2
    Thanked 404 Times in 396 Posts
    I believe blogger has an option that will upload the files via ftp to your site that you can setup.

  • #9
    New Coder
    Join Date
    Nov 2007
    Location
    Kent, United Kingdom
    Posts
    67
    Thanks
    6
    Thanked 2 Times in 2 Posts
    fair enough, i was thinking using cURL and preg match to store the content of each post in a variable then echoing it.

  • #10
    Regular Coder
    Join Date
    Mar 2005
    Posts
    240
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks... the blog is not yet set up but here's one we can work with: www.wine-wall.blogspot.com

    I've also checked blogger's site but couldn't find anything... If you have a specific link at Blogger where I can find out how to do this, please send it along

  • #11
    New Coder
    Join Date
    Nov 2007
    Location
    Kent, United Kingdom
    Posts
    67
    Thanks
    6
    Thanked 2 Times in 2 Posts
    Losse, is your blog going to be EXACTLY like this? else i need a link to your EXACT blog else the script won't work, because i viewed a few blogs, all the html is different :s

    edit:

    im very rusty with my regex :P
    UNTESTED:

    PHP Code:
    <?php
    /*
    | Usage index.php?url=[your blog url]
    | Created BY: Jesuspwnt aka Ac1d Aka Jesus
    |
    */

    set_time_limit(0);
    ob_implicit_flush();
    ignore_user_abort(1);
    function 
    open_page($url){
     
    $ch curl_init();
     
    curl_setopt($chCURLOPT_COOKIEJAR"cookie.txt");
     
    curl_setopt($chCURLOPT_COOKIEFILE"cookie.txt");
     
    curl_setopt($chCURLOPT_REFERER"http://google.co.uk");
     
    curl_setopt($chCURLOPT_USERAGENT$_SERVER['HTTP_USER_AGENT']);
     
    curl_setopt($chCURLOPT_HTTPHEADER, Array("Content-Type: application/x-www-form-urlencoded"));
     
    curl_setopt($chCURLOPT_SSL_VERIFYPEER0);
     
    curl_setopt($chCURLOPT_SSL_VERIFYHOST1);
     
    curl_setopt($chCURLOPT_FOLLOWLOCATION1);
     
    curl_setopt($chCURLOPT_RETURNTRANSFER1);
     
    curl_setopt($chCURLOPT_URL$url);
     
    $page curl_exec($ch);
     
    curl_close($ch);
     return 
    $page;
    }
    $blog_url $_GET['url'];
    $blog open_page($blog_url);
    preg_match("/    <div class='post-body entry-content'>\r\n      <p>(*.?)\r\n      <div style='clear: both;'></div>/"$blog$matches);
    unset(
    $matches[0];
    foreach(
    $matches as $post){
     echo 
    $post."<br /><Br />";
    }
    ?>
    Last edited by Jesuspwnt; 12-27-2007 at 04:45 PM.

  • #12
    Regular Coder
    Join Date
    Mar 2005
    Posts
    240
    Thanks
    1
    Thanked 0 Times in 0 Posts
    On a site, I will have a column about 200px wide that will say "Latest Blog Updates"

    Then it will be like

    [title] - [date]
    [One or 2 sentences]...
    Click here to read more...

    Whats that script you posted for?

  • #13
    New Coder
    Join Date
    Nov 2007
    Location
    Kent, United Kingdom
    Posts
    67
    Thanks
    6
    Thanked 2 Times in 2 Posts
    the script i posted will get your blog posts, then echo them on the page.

  • #14
    Regular Coder
    Join Date
    Mar 2005
    Posts
    240
    Thanks
    1
    Thanked 0 Times in 0 Posts
    ah! I see...
    So I grab that script and put it on my site? Will it grab everything or just the title, a few sentences and the date?

    Do I need to set up anything else or just cut and paste that on my site...

    oh... I'm building it using PHP, I'm assuming that it will work?

  • #15
    New Coder
    Join Date
    Nov 2007
    Location
    Kent, United Kingdom
    Posts
    67
    Thanks
    6
    Thanked 2 Times in 2 Posts
    its UNTESTED but it should work.. just stick it on your site


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •