Avatar of bsharath
bsharathFlag for India

asked on 

Help to Modify this code so it works for this website

help to
Modify this code so it works for this website

http://mtas.surfcontrol.com/mtas/MTAS.asp

retrieve the category to a column

I will have the website names into the txt file

Script scans each site with "mtas.surfcontrol.com" and lists the category


strInputFile = "input.txt"
strOutputFile = "output.txt"

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objHTTP = CreateObject("MSXML2.XMLHTTP")

Set objInput = objFSO.OpenTextFile(strInputFile, 1, False)
Set objOutput = objFSO.CreateTextFile(strOutputFile, True)

Set objIE = CreateObject("InternetExplorer.Application")
objIE.Visible = True
objIE.Navigate "http://moonsy.com/pagerank_checker/"
While objIE.busy = True Or objIE.ReadyState <> 4
      WScript.Sleep 100
Wend

While Not objInput.AtEndOfStream
      strURL = Trim(objInput.ReadLine)
      If strURL <> "" Then
            objIE.document.form1.domain.value = strURL
            objIE.document.form1.submit.click
            While objIE.busy = True Or objIE.ReadyState <> 4
                  WScript.Sleep 100
            Wend
            strRank = InStr(1, objIE.Document.body.innerText, "your page rank", vbTextCompare)
            If strRank = 0 Then
                  objOutput.WriteLine strURL & ",NOT FOUND"
                  'WScript.Echo strURL & ",NOT FOUND"
            Else
                  strRank = Replace(Trim(Mid(objIE.Document.body.innerText, strRank, 21)), "Your Page Rank:", "")
                  objOutput.WriteLine strURL & "," & strRank
                  'WScript.Echo strURL & "," & strRank
            End If
      End If
Wend
objInput.Close
objOutput.Close

Set objHTTP = Nothing
objIE.Quit
ProgrammingVB Script

Avatar of undefined
Last Comment
Robert Schutt
Avatar of bsharath
bsharath
Flag of India image

ASKER

Some more info
The current code above places each website name in a site http://moonsy.com/pagerank_checker/ and finds the PR

Now the same code can we change to be placed from txt file each website name into
http://mtas.surfcontrol.com/mtas/MTAS.asp

then find what category the website is from?
ASKER CERTIFIED SOLUTION
Avatar of Robert Schutt
Robert Schutt
Flag of Netherlands image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of bsharath
bsharath
Flag of India image

ASKER

Thanks a lot
Works like a charm

Can you help with this
https://www.experts-exchange.com/questions/27978528/Find-and-replace-words-in-a-website.html

Similar to the first one
Avatar of Robert Schutt
Robert Schutt
Flag of Netherlands image

I had a quick look but it seems there will be a different screen when you are logged in as administrator (multiple edit buttons?). Maybe you should post some more info like a screendump of how it looks for you and clearly marked which part (or multiple parts) you want to change (and which steps that will entail). I didn't post in that new question because it might put other experts off if you're already receiving help (I have a saved search myself that looks explicitly for questions that have nobody helping yet).

It would probably help attracting other experts if you post a link to earlier solutions (like http:/Q_27976953.html). Also, often it's better to show that you made an effort at solving at least part of it and only then ask for specific help with some adjustments that you can't work out yourself.

HTH, Robert.
Avatar of bsharath
bsharath
Flag of India image

ASKER

Thanks Robert

When you login to the post i mentioned with the credentials you can see an Edit button and i will have the same in my admin screen as well but a few others like delete comment etc may be available

I have added the screenshot in that post , please have a look
Avatar of Robert Schutt
Robert Schutt
Flag of Netherlands image

I'll leave that new question open for now, I'm afraid I don't have the time to try and tackle it today/tonight. At first glance it seems like a horrible task to parse that output, if it's capturable at all. Have you tried looking for code to detect/follow http redirects directly instead of via that website?
Avatar of bsharath
bsharath
Flag of India image

ASKER

>.Have you tried looking for code to detect/follow http redirects directly instead of via that website?

No can you please direct me so i can search
Avatar of Robert Schutt
Robert Schutt
Flag of Netherlands image

A quick google shows that it should be possible to use the HTTP request for a HEAD operation instead of the default GET. Then you can determine the new url. If necessary repeat (not sure about that though). I'll have to try it out and if I find something will post on your new question.
Avatar of Robert Schutt
Robert Schutt
Flag of Netherlands image

bit busy at the moment but check this out, second script on this page: http://www.paulsadowski.com/wsh/xmlhttp.htm
Avatar of Robert Schutt
Robert Schutt
Flag of Netherlands image

I was wrong about parsing the output of that website, will post a solution on your follow-up question shortly.
Programming
Programming

Programming includes both the specifics of the language you’re using, like Visual Basic, .NET, Java and others, but also the best practices in user experience and interfaces and the management of projects, version control and development. Other programming topics are related to web and cloud development and system and hardware programming.

55K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo