Get Selected HTMl

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ojsimon
    New Member
    • May 2007
    • 59

    Get Selected HTMl

    Hi
    Is it possible for a js or client side script to show the user any site that they enter, then let then select a certain area (possibly with a crop tool) and the script to get the html code for the selected area? how could i do this? any help would be really appreciated.

    thanks
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    I've seen what you're looking for on Webwag: their Widget On Demand feature.

    Comment

    • ojsimon
      New Member
      • May 2007
      • 59

      #3
      Originally posted by acoder
      I've seen what you're looking for on Webwag: their Widget On Demand feature.
      How would you go about doing this?

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Firstly, try using a cropper tool to get content from your own site. Search for one - you should find some good ones.

        Once you get that working, you now need to get the other site from your domain to avoid cross-domain issues. To do that, make a Http request from the server-side to get the page onto your own domain.

        Comment

        • ojsimon
          New Member
          • May 2007
          • 59

          #5
          Hi
          How would you adjust the cropper tool to work with html though. It is my understanding they only work for images?
          Thanks

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            They use an image cropper (Defusion's), get the dimensions and use that to get the part of the page from the HTML. See the source code.

            Comment

            • ojsimon
              New Member
              • May 2007
              • 59

              #7
              Originally posted by acoder
              They use an image cropper (Defusion's), get the dimensions and use that to get the part of the page from the HTML. See the source code.
              Sorry but i still dont understand how do you use dimensions, to crop html? and also will this update dynamicaly?

              Thanks

              Comment

              • acoder
                Recognized Expert MVP
                • Nov 2006
                • 16032

                #8
                Look at the source code of webwag_sel.php. Use Firebug to inspect elements. Of course, this is only one site - there may be others with similar code.

                Comment

                • ojsimon
                  New Member
                  • May 2007
                  • 59

                  #9
                  Originally posted by acoder
                  Look at the source code of webwag_sel.php. Use Firebug to inspect elements. Of course, this is only one site - there may be others with similar code.
                  Hi
                  i've worked out that webwag is just using frames. I found this one which works how i would like mine too grid.orch8.net/
                  How can i make something like this?

                  Thanks

                  Comment

                  • acoder
                    Recognized Expert MVP
                    • Nov 2006
                    • 16032

                    #10
                    They both use iframes, as would probably any similar website.

                    Interesting that they allow you to select elements rather than select an area of the page. If anything, that would be easier to implement.

                    Again, the source JavaScript files are there for you to look at. You may find more information on their blog.

                    I would suggest you start off with something small and simple and then extend it.

                    Comment

                    • ojsimon
                      New Member
                      • May 2007
                      • 59

                      #11
                      Originally posted by acoder
                      They both use iframes, as would probably any similar website.

                      Interesting that they allow you to select elements rather than select an area of the page. If anything, that would be easier to implement.

                      Again, the source JavaScript files are there for you to look at. You may find more information on their blog.

                      I would suggest you start off with something small and simple and then extend it.
                      Hi
                      I have got most of it to work extracting the javascripts but the one thing that doesnt work is when the site wont load in the selection interface, i think this requires php to fetch the html or contents, could you help me fix all this up? are you sure its using iframes, because when the widget is created the html is sometimes formated differently i think they are utilizing dom structure, or js to get php parsing points but i dont know?

                      Thanks

                      Thanks

                      Comment

                      • acoder
                        Recognized Expert MVP
                        • Nov 2006
                        • 16032

                        #12
                        Originally posted by ojsimon
                        I have got most of it to work extracting the javascripts but the one thing that doesnt work is when the site wont load in the selection interface, i think this requires php to fetch the html or contents, could you help me fix all this up?
                        I mentioned about this earlier. You need to get the website content onto your domain before you can manipulate it. Use cURL - ask in the PHP forum for more details.
                        Originally posted by ojsimon
                        are you sure its using iframes, because when the widget is created the html is sometimes formated differently i think they are utilizing dom structure, or js to get php parsing points but i dont know?
                        They use iframes for the initial part, though you could use Ajax. The HTML might be formatted differently if it's within a parent container which isn't included or the CSS is not copied.

                        Comment

                        • ojsimon
                          New Member
                          • May 2007
                          • 59

                          #13
                          Originally posted by acoder
                          I mentioned about this earlier. You need to get the website content onto your domain before you can manipulate it. Use cURL - ask in the PHP forum for more details.
                          They use iframes for the initial part, though you could use Ajax. The HTML might be formatted differently if it's within a parent container which isn't included or the CSS is not copied.

                          Hi
                          I think this job is too complicated for me, would you do this freelance?

                          Thanks

                          Comment

                          • acoder
                            Recognized Expert MVP
                            • Nov 2006
                            • 16032

                            #14
                            Not on this site, I'm afraid. You could try some popular freelance sites.

                            However, if you have a real job in mind with sufficient renumeration, put a job posting up in the IT Jobs forum.

                            Comment

                            • ojsimon
                              New Member
                              • May 2007
                              • 59

                              #15
                              Originally posted by acoder
                              Not on this site, I'm afraid. You could try some popular freelance sites.

                              However, if you have a real job in mind with sufficient renumeration, put a job posting up in the IT Jobs forum.

                              Ok so ive decided to continue with this as i cannot afford freelancing. Im having major problems getting the site to load though, there are quite a few files in the folder, can anyone help me get the site to load ? any help is really appreciated. if anyone has any resources which may help please tell me.

                              thanks
                              Olie

                              Comment

                              Working...