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.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Nov 2009
    Posts
    30
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Regex / GetElementByID Help

    SOLVED






    1) Project Details: (be as specific as possible):

    I need some help extracting some information from a dealerships website. Normally I use GetElementById and then RegEx to find a vehicles vin number on a vehicles details page.

    Code:
    var result = document.getElementById('vehicleInformation').parentNode.innerHTML;
    var regExp = /[A-Z0-9]{17,17}/g;
    result = result.match(regExp);
    result = result[0];
    But the new site that I have to work with does not have any div id's or tags, only classes. And to make things even harder, the website has vehicles listed with vin numbers hidden in the source code towards the top, so there are many different vin numbers on the page and I can't find a way to get the right one.

    Here is a web page that I have to work with.

    http://www.fisherkia.net/vehicle-det...r-co-id-780023

    I need to reliably get the VIN number of this vehicle in a variable, and I would love it if someone can figure out how to get the year and model in a variable also.

    2) Payment Amount:

    $20 sent via paypal

    Thanks and please let me know if you have any questions
    Marc
    Last edited by mdamon; 04-16-2011 at 03:02 AM.

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    So you are using Javascript to scrape this webpage? Not a server-side language?

    Best thing to do is first find the DIV with the innerHtml value of "VIN #" and then use the next DIV innerHtml value which should be the VIN #. I could code a PHP script to do this pretty easily but I don't know how that fits into your larger picture.

  • #3
    New Coder
    Join Date
    Nov 2009
    Posts
    30
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fumigator View Post
    So you are using Javascript to scrape this webpage? Not a server-side language?

    Best thing to do is first find the DIV with the innerHtml value of "VIN #" and then use the next DIV innerHtml value which should be the VIN #. I could code a PHP script to do this pretty easily but I don't know how that fits into your larger picture.
    I have to use Javascript for this, can you do this in JS?

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Do you have control of the code on fisherkia.com? If you don't then your javascript won't work either. In which case you would have to use a server side language like php.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #5
    New to the CF scene
    Join Date
    Apr 2011
    Location
    Mali
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    is there true

    just amazing !! xa-xa-xa

  • #6
    New Coder
    Join Date
    Nov 2009
    Posts
    30
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Problem Solved

    Thanks!


  •  

    Posting Permissions

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