Feed data from another server/site

Discussion in 'PHP' started by bennjoe, Oct 7, 2008.

  1. #1
    I need to develop a system that can retrieve data from another server.

    The system are for testimonial manager, which the process is like this:

    -Users can post the testimonial and save it into the system.

    -system will generate a few piece of code for the testimonials

    -the code can be used/paste/embed into another site(any sites) via html

    -the testimonial will be displayed on the site - which the data is come from the system

    Did you guys get what i mean? I just need a logic how to do that..
    is it can be done just by php, or we need xml, or watever...?

    please help.

    Thanks in advanced
     
    bennjoe, Oct 7, 2008 IP
  2. joxtechnology

    joxtechnology Peon

    Messages:
    146
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    yeah you can use xml for that. from your description its function is actually same with rss feeds. or you can also write a script that will constantly update the xml file then create a xml parser on on your other site to display the xml content.
     
    joxtechnology, Oct 7, 2008 IP
  3. GuitarFix

    GuitarFix Peon

    Messages:
    37
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    GuitarFix, Oct 7, 2008 IP
  4. bennjoe

    bennjoe Peon

    Messages:
    134
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    hmm.. thank for the kind reply,

    but im kinda new with xml. can i know, if i use xml, can i get the data from mysql?
     
    bennjoe, Oct 7, 2008 IP
  5. GuitarFix

    GuitarFix Peon

    Messages:
    37
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Well.. you can get data from mysql to your php script.. :) and then you can return the data as xml..
     
    GuitarFix, Oct 7, 2008 IP
  6. cornetofreak

    cornetofreak Peon

    Messages:
    170
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #6
    i would recommend using preg_match or preg_match_all and curl to cellect the data from the site and bring it back to you to place into a mysql database :)
     
    cornetofreak, Oct 7, 2008 IP
  7. StevieC

    StevieC Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I need to do something similar. I would like to offer other sites the facility to display some data (tables etc) generated by my server on their site.

    Wouldn't using iframe be a good way of going about it? I know iframe code can be a security risk but I believe that is only if you don't 'trust' the site that the data is coming from. Is that correct?
     
    StevieC, Oct 9, 2008 IP
  8. Sillysoft

    Sillysoft Active Member

    Messages:
    177
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #8
    You can include a php script using javascript:

    
    <script language="JavaScript" src="url to your script.php"></script>
    
    HTML:
    In the php script itself you would have to do something like this at the end of the script I believe to get it to output your end result:

    
    document.write(<?php echo $output; ?>);
    
    HTML:
    That way you can use your php script and javascript is simple to setup on the other persons website.
     
    Sillysoft, Oct 9, 2008 IP
  9. GuitarFix

    GuitarFix Peon

    Messages:
    37
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #9
    But there will be a problem with search engines (as far as I know, SEs can't index JS content..).
     
    GuitarFix, Oct 9, 2008 IP
  10. StevieC

    StevieC Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Cheers guys.
    I still think that using iframe looks easy and doesn't require javascript.
    All the remote server needs to put in the source is:
    <iframe src="http://www.mysite.com/testfile.php" id="frame1"></iframe>

    Does anyone have reasons not to use this?
     
    StevieC, Oct 10, 2008 IP
  11. saurabhmutha

    saurabhmutha Banned

    Messages:
    77
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    I can Code what you Want for 35$ ..... Hit me a PM if you are intrested....
     
    saurabhmutha, Oct 10, 2008 IP
  12. GuitarFix

    GuitarFix Peon

    Messages:
    37
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Sure!
    First of all, it has very ugly looking :)
    And the second, a frame blocks often by firewalls (security problems).
     
    GuitarFix, Oct 11, 2008 IP