+ Reply to Thread
Results 1 to 8 of 8

Get real source code of webpage

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-14-2017
    Location
    Poland
    MS-Off Ver
    2016
    Posts
    107

    Get real source code of webpage

    Hi all.

    I'm using simple code to get source code of webpage. In the most cases it works fine, but with some kind of urls the source code is different than in the browser(right click->view page source). It looks like source code of some scripts instead of text data visible on the webpage.

    example url: https://www.google.com/search?q=site...ps://tophd.pl/

    Dim URL, odp As String
    Dim x As Integer
    
    URL = Range("A1").Value
    With CreateObject("MSXML2.XMLHTTP")
        .Open "GET", URL, False
        .send
     Range("B1").Value = .ResponseText
    End With
    Attached Files Attached Files

  2. #2
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Get real source code of webpage

    what are you saying? are you saying that the source code found here:

    https://tophd.pl/

    is different than the source code found here?

    https://www.google.com/search?q=site...ps://tophd.pl/

    if so, well of course it is!

    when you say:
    but with some kind of urls the source code is different than in the browser
    not really understanding that. the source code is different WHERE? when you're comparing the browser to WHAT? other software programs you are using to view page sources of URLs? you should know that source code generated on the return page of a google search is more than likely generated by a server that throws out garbled junk that is unintelligble. furthermore, have you seen the KB from MS regarding the async call you are using?

    https://docs.microsoft.com/en-us/pre...62275(v=vs.85)

  3. #3
    Forum Contributor
    Join Date
    03-14-2017
    Location
    Poland
    MS-Off Ver
    2016
    Posts
    107

    Re: Get real source code of webpage

    Hi,

    When Im using VBA code like in the file Im retrieving different source code than I open the same website manually and right clic on this site and choose "view source page".

    When you click on the link in A1 cell, the website will open and click right mouse button and select "view source page" I want in cell B1 this source code.

  4. #4
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Get real source code of webpage

    Quote Originally Posted by mtcas View Post
    When Im using VBA code like in the file Im retrieving different source code than I open the same website manually and right clic on this site and choose "view source page".
    that could be for any number of reasons. I don't really believe what you're saying, and I apologize for that. but then again, you might be getting XML data back, and that's what you're calling ""different"". post the code you are using.

  5. #5
    Forum Contributor
    Join Date
    03-14-2017
    Location
    Poland
    MS-Off Ver
    2016
    Posts
    107

    Re: Get real source code of webpage

    Ok, sorry. I found the problem. Max chars in cell can be 32767 and I thought that something is wrong because source code was not copied all.
    To delete

  6. #6
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Get real source code of webpage

    LOL. well you didn't say that it was truncated, silly! you said it was different! geez. well good luck anyway

  7. #7
    Forum Contributor
    Join Date
    03-14-2017
    Location
    Poland
    MS-Off Ver
    2016
    Posts
    107

    Re: Get real source code of webpage

    It was different for me because one source was truncated from VBA and second source was completed from website:P

  8. #8
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Get real source code of webpage

    well of course it was! LOL. the 32656 size of a cell you mentioned (or whatever number it was), obviously is a power of 2 like everything is. and thus, it's different. the size is in bytes, I think. 1 byte = 1 ASCII character

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Webpage doesn't get fully loaded. Want to use a VBA code to wait for the webpage.
    By Danzong in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-16-2017, 02:55 AM
  2. Extracting webpage source code using VBE
    By rolex in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-08-2017, 02:24 PM
  3. Extract Source code webpage and display in Excelfield
    By martijnrikkert in forum Excel General
    Replies: 0
    Last Post: 02-23-2017, 09:43 AM
  4. [SOLVED] Scrape page source from webpage
    By abousetta in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 12-22-2016, 05:42 PM
  5. [SOLVED] Extract Complete HTML Source code of webpage
    By Naveed Raza in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-16-2016, 02:06 PM
  6. Vba code for using webpage ( Tracking Goods c/ment on webpage)
    By satputenandkumar0 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-30-2013, 06:03 AM
  7. Help in getting to full HTML source code for webpage via Excel VBA
    By stuht in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-07-2013, 05:41 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1