1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

getting dynamic web page content

Discussion in 'JavaScript' started by JLThompson999, Dec 10, 2021.

  1. JLThompson999

    JLThompson999 Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #21
    Not sure I see how having my server call the page and the client call the server saves time. That's two calls the client has to wait to complete, not just one.
     
    JLThompson999, Feb 13, 2022 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #22
    Your server should call and process the info more efficiently than a browser
    The feed that the user eventually gets will be smaller - important if they're on mobile or even wifi - they're downloading a small json feed, not an entire webpage
    The processing is reliable because you have control over your server and all browsers can manage a json feed.
    You don't have to worry about cors issues.

    Here's an challenge, I haven't done one of these in a while.

    Scrape https://forums.digitalpoint.com/find-new/posts and show each link on a page
    Then take this feed https://www.itamer.com/muck/dpnewthreads.php and display each link on a page

    which is quicker?

    bearing in mind that itamer.com is on very average shared hosting and may be slower than your hosting.

    Here's a codepen - which will also be slower than in live but it gives you some code to get started
    https://codepen.io/itamer/pen/ZEaJqzr
     
    Last edited: Feb 13, 2022
    sarahk, Feb 13, 2022 IP
  3. JLThompson999

    JLThompson999 Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #23
    OK, sounds like the idea is worth testing. But whatever way I do it, I still need to know: is the method I used above capable of returning the html code, or do I need to do something different?
     
    JLThompson999, Feb 14, 2022 IP
  4. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #24
    It's capable, and I've shown it working (slowly). Your stumbling block is CORS. If the site isn't letting you scrape then you can't use javascript.
     
    sarahk, Feb 15, 2022 IP
  5. JLThompson999

    JLThompson999 Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #25
    OK, so I am going to try out your processing it on the server and outputting the data as json idea, but I must again reiterate my limited knowledge of these programming languages. In the foreach code in the example you gave, say I wanted each div name put in the form of a string like so: "name1/name2/name3," how would I do that?

    The string would be stored in $output"
     
    Last edited by a moderator: Feb 20, 2022
    JLThompson999, Feb 19, 2022 IP
  6. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #26
    foreach ($divs as $div) {
      ... whatever you need to do... save result in $output
    }
    PHP:
    concatenating/adding strings together is the easy part.
    $output = "$name1/$name2/$name3,"
    PHP:
    I'm just not sure where you're getting the $name1 etc from. you may need to build in more loops etc.
     
    sarahk, Feb 20, 2022 IP
  7. JLThompson999

    JLThompson999 Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #27
    The names are from the div tags. The thing I'm looking for. It's not string concatenation I was asking about, but where the data I'm looking for can be found. I am unfamiliar with the foreach command. Or json. Foreach? $divs as $div? Greek to me. I'm gathering your code takes the html data and organizes it in some way, but beyond that, I've no idea what you're on about here.
     
    JLThompson999, Feb 20, 2022 IP
  8. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #28
    Then you have to do some experimentation & learn.
    or share the page you're scraping along with your desired outcome.

    Your name1, name2 wasn't clear either since I have no idea what the structure of your source data is.
     
    sarahk, Feb 20, 2022 IP
  9. JLThompson999

    JLThompson999 Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #29
    I work full time and have much else on my plate besides. I have no time to go experimenting and learning theory. I just need a simple question answered: using this technique, what code will allow me to take the names of divs and put them in a variable?
     
    JLThompson999, Feb 20, 2022 IP
  10. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #30
    Google is your friend
    The PHP example is in post #26
    Javascript is just
    let myVar = var1 + "/" + var2;
    Code (JavaScript):
    We all have work to do, and commitments. We try to help but you have to do some of it yourself. You need to make the time for experimenting and learning or else you're going to be stuck when the source page changes something and breaks your code.

    How are you going to create your app if you have no time for learning? Even with tools like bubble and jasonelle you have things you have to learn.
     
    sarahk, Feb 20, 2022 IP
  11. JLThompson999

    JLThompson999 Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #31
    Don't presume to tell me what I am or am not capable of doing, or of what I need down the line. I'm a high functioning autistic savant. I'm quite capable of doing rather a lot with just an example or two, and I learn much more quickly that way than I do studying in the way that works for neurotypicals. If you don't want to answer my question, fine. Nobody's forcing you to. But just say you don't want to take the time. Or just don't respond. Don't talk down to me. I'm not your student. I'm not your child.
     
    JLThompson999, Feb 20, 2022 IP
  12. Spoiltdiva

    Spoiltdiva Acclaimed Member

    Messages:
    7,739
    Likes Received:
    2,896
    Best Answers:
    53
    Trophy Points:
    520
    #32
    @sarahk has gone out of her way to help you on this thread and this is how you respond? If you don't wish to be treated like a child, then don't behave like one.
     
    Spoiltdiva, Feb 20, 2022 IP
    mmerlinn and sarahk like this.
  13. JLThompson999

    JLThompson999 Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #33
    Help me? By never answering direct questions? By dragging out what should have just been my quickly checking on a couple of facts? By arrogantly telling me what I need to do instead of respecting my ability to know what I need myself? I don't know how they do things where you come from "Spoiltdiva," but where I come from, refusing to answer a direct question is considered rude, and making decisions for other people is considered even ruder.

    OK, I see I need to find a place with adults. See ya. So to speak.
     
    JLThompson999, Feb 20, 2022 IP
  14. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #34
    You were in the discussion section of the forum - this is where we discuss stuff.
    If you wanted to hire someone to do it we have a whole section for that!

    Then you should find all of this easy and not be stuck concatenating strings FFS. One thing to bear in mind is that programmers are, mostly, neurodivergent and your autism is considered "normal" here.
     
    sarahk, Feb 20, 2022 IP
    mmerlinn likes this.
  15. mmerlinn

    mmerlinn Prominent Member

    Messages:
    3,197
    Likes Received:
    818
    Best Answers:
    7
    Trophy Points:
    320
    #35
    If you have no time to work at this, HIRE someone to do it for you. If you cannot afford the money or the time, then table the project until you can afford it.

    Further, we are here to point you in the right direction, NOT to hold your hand and do your job. If you have no time for this, there is no reason for you to expect help from us nor from anyone else.
     
    mmerlinn, Feb 20, 2022 IP
    sarahk and Spoiltdiva like this.
  16. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #36
    sarahk, Feb 21, 2022 IP