Hi. I'm looking for a way to check a hyperlink string and see if the
web page actually exists on the Internet. Couple of months ago I was
given the following example:

local oHTTP, cServer
cServer = "www.microsoft.com"
xmlhttp = create("Microsoft.XMLHTTP")
xmlhttp.Open("GET", cServer, .f. )
xmlhttp.send()

When I try it, however, I get an OLE error. I was also told to search
for winsock on http://fox.wikis.com . I saw samples on how to retrieve
the IP address and validating email addresses, but nothing on
hyperlinks. I'm not familiar with the workings of winsock, so any
advice would be greatly appreciated...Dennis

Re: Verify Hyperlinks by Rolf

Rolf
Thu Jul 17 16:08:44 CDT 2008

local oHTTP, cServer
cServer = "http://www.microsoft.com"
xmlhttp = create("Microsoft.XMLHTTP")
xmlhttp.Open("GET", cServer, .f. )
TRY
xmlhttp.send()
? "OK"
CATCH
? "Not so good"
ENDTRY



"Dennis Allen" <dennis@dennisallen.com> skrev i melding
news:u5ad7vD6IHA.5012@TK2MSFTNGP02.phx.gbl...
> Hi. I'm looking for a way to check a hyperlink string and see if the web
> page actually exists on the Internet. Couple of months ago I was given
> the following example:
>
> local oHTTP, cServer
> cServer = "www.microsoft.com"
> xmlhttp = create("Microsoft.XMLHTTP")
> xmlhttp.Open("GET", cServer, .f. )
> xmlhttp.send()
>
> When I try it, however, I get an OLE error. I was also told to search for
> winsock on http://fox.wikis.com . I saw samples on how to retrieve the IP
> address and validating email addresses, but nothing on hyperlinks. I'm
> not familiar with the workings of winsock, so any advice would be greatly
> appreciated...Dennis



Re: Verify Hyperlinks by Rolf

Rolf
Thu Jul 17 16:18:37 CDT 2008


local xmlHTTP, cServer
cServer = "http://www.microsoft.com"
xmlhttp = create("Microsoft.XMLHTTP")
xmlhttp.Open("GET", cServer, .f. )
TRY
xmlhttp.send()
? "OK"
CATCH
? "Not OK"
ENDTRY



Re: Verify Hyperlinks by Dennis

Dennis
Thu Jul 17 21:12:52 CDT 2008

Thanks for the reply.

TRY/CATCH? Is there a way to use those commands in VFP6? If not, is
there another way to head off the OLE error?

"Rolf Lystad" <rolf@invalid.invalid> wrote in message
news:%23fGSmGF6IHA.616@TK2MSFTNGP02.phx.gbl...
>
> local xmlHTTP, cServer
> cServer = "http://www.microsoft.com"
> xmlhttp = create("Microsoft.XMLHTTP")
> xmlhttp.Open("GET", cServer, .f. )
> TRY
> xmlhttp.send()
> ? "OK"
> CATCH
> ? "Not OK"
> ENDTRY
>
>


Re: Verify Hyperlinks by Dennis

Dennis
Thu Jul 17 21:27:38 CDT 2008

Hi again. Still don't know how to use TRY with my VFP6, but the code
seems to be working. http://fox.wikis.com/wc.dll?Wiki~XMLHTTP~VFP
explains a little. xmlhttp.status()=200 means the web page or jpg file,
was found.

Question. Seems to want to load the enitre web page or jpg image before
returning the status. Is there a way to retrieve just a header? I
don't need the file, just need to know it exists...Dennis


"Rolf Lystad" <rolf@invalid.invalid> wrote in message
news:%23fGSmGF6IHA.616@TK2MSFTNGP02.phx.gbl...
>
> local xmlHTTP, cServer
> cServer = "http://www.microsoft.com"
> xmlhttp = create("Microsoft.XMLHTTP")
> xmlhttp.Open("GET", cServer, .f. )
> TRY
> xmlhttp.send()
> ? "OK"
> CATCH
> ? "Not OK"
> ENDTRY
>
>


Re: Verify Hyperlinks by Bernhard

Bernhard
Fri Jul 18 03:42:17 CDT 2008

Hi Dennis

> Question. Seems to want to load the enitre web page or jpg image before
> returning the status. Is there a way to retrieve just a header? I
> don't need the file, just need to know it exists...Dennis

>> xmlhttp.Open("GET", cServer, .f. )
Use "HEAD" instead of "GET"
For more info have a look at the HTTP protocol

Regards
Bernhard Sander

Re: Verify Hyperlinks by Dan

Dan
Fri Jul 18 10:35:08 CDT 2008

This is basically the same thing, and goes back to Foxpro/DOS:

lcError = On("Error")
llError = .f.
On Error *
YourCommandHere
On Error &lcError
If Not llError
* cool beans
Else
* nope
Endif

Dan

Dennis Allen wrote:
> Thanks for the reply.
>
> TRY/CATCH? Is there a way to use those commands in VFP6? If not, is
> there another way to head off the OLE error?
>
> "Rolf Lystad" <rolf@invalid.invalid> wrote in message
> news:%23fGSmGF6IHA.616@TK2MSFTNGP02.phx.gbl...
>>
>> local xmlHTTP, cServer
>> cServer = "http://www.microsoft.com"
>> xmlhttp = create("Microsoft.XMLHTTP")
>> xmlhttp.Open("GET", cServer, .f. )
>> TRY
>> xmlhttp.send()
>> ? "OK"
>> CATCH
>> ? "Not OK"
>> ENDTRY



Re: Verify Hyperlinks by Gianni

Gianni
Fri Jul 18 16:58:09 CDT 2008

Sorry Dan,

I must correct you:

lcError = On("Error")
llError = .f.
On Error llError = .t.
YourCommandHere
On Error &lcError
If Not llError
* cool beans
Else
* nope
Endif

Error was on line 3.

--
Gianni

On Fri, 18 Jul 2008 08:35:08 -0700, "Dan Freeman" <spam@microsoft.com> wrote:

>This is basically the same thing, and goes back to Foxpro/DOS:
>
>lcError = On("Error")
>llError = .f.
>On Error *
>YourCommandHere
>On Error &lcError
>If Not llError
> * cool beans
>Else
> * nope
>Endif
>
>Dan
>
>Dennis Allen wrote:
>> Thanks for the reply.
>>
>> TRY/CATCH? Is there a way to use those commands in VFP6? If not, is
>> there another way to head off the OLE error?
>>
>> "Rolf Lystad" <rolf@invalid.invalid> wrote in message
>> news:%23fGSmGF6IHA.616@TK2MSFTNGP02.phx.gbl...
>>>
>>> local xmlHTTP, cServer
>>> cServer = "http://www.microsoft.com"
>>> xmlhttp = create("Microsoft.XMLHTTP")
>>> xmlhttp.Open("GET", cServer, .f. )
>>> TRY
>>> xmlhttp.send()
>>> ? "OK"
>>> CATCH
>>> ? "Not OK"
>>> ENDTRY

--
Gianni
g.turri@elabora.it

Re: Verify Hyperlinks by Dan

Dan
Fri Jul 18 17:01:43 CDT 2008

Thanks!

Gianni Turri wrote:
> Sorry Dan,
>
> I must correct you:
>
> lcError = On("Error")
> llError = .f.
> On Error llError = .t.
> YourCommandHere
> On Error &lcError
> If Not llError
> * cool beans
> Else
> * nope
> Endif
>
> Error was on line 3.
>
> --
> Gianni
>
> On Fri, 18 Jul 2008 08:35:08 -0700, "Dan Freeman"
> <spam@microsoft.com> wrote:
>
>> This is basically the same thing, and goes back to Foxpro/DOS:
>>
>> lcError = On("Error")
>> llError = .f.
>> On Error *
>> YourCommandHere
>> On Error &lcError
>> If Not llError
>> * cool beans
>> Else
>> * nope
>> Endif
>>
>> Dan
>>
>> Dennis Allen wrote:
>>> Thanks for the reply.
>>>
>>> TRY/CATCH? Is there a way to use those commands in VFP6? If not,
>>> is there another way to head off the OLE error?
>>>
>>> "Rolf Lystad" <rolf@invalid.invalid> wrote in message
>>> news:%23fGSmGF6IHA.616@TK2MSFTNGP02.phx.gbl...
>>>>
>>>> local xmlHTTP, cServer
>>>> cServer = "http://www.microsoft.com"
>>>> xmlhttp = create("Microsoft.XMLHTTP")
>>>> xmlhttp.Open("GET", cServer, .f. )
>>>> TRY
>>>> xmlhttp.send()
>>>> ? "OK"
>>>> CATCH
>>>> ? "Not OK"
>>>> ENDTRY



Re: Verify Hyperlinks by Dennis

Dennis
Fri Jul 18 19:17:41 CDT 2008

That's what I used. Thanks.

I've got the code working. The only problem thus far is one web site
that didn't want to work. Don't know whether it's on the open or send.
Had to disconnect from the Internet to get the code to let go. Is there
a way to add a timeout to the xmlhttp object?

"Dan Freeman" <spam@microsoft.com> wrote in message
news:%23vYdeHS6IHA.2260@TK2MSFTNGP03.phx.gbl...
> Thanks!
>
> Gianni Turri wrote:
>> Sorry Dan,
>>
>> I must correct you:
>>
>> lcError = On("Error")
>> llError = .f.
>> On Error llError = .t.
>> YourCommandHere
>> On Error &lcError
>> If Not llError
>> * cool beans
>> Else
>> * nope
>> Endif
>>
>> Error was on line 3.
>>
>> --
>> Gianni
>>
>> On Fri, 18 Jul 2008 08:35:08 -0700, "Dan Freeman"
>> <spam@microsoft.com> wrote:
>>
>>> This is basically the same thing, and goes back to Foxpro/DOS:
>>>
>>> lcError = On("Error")
>>> llError = .f.
>>> On Error *
>>> YourCommandHere
>>> On Error &lcError
>>> If Not llError
>>> * cool beans
>>> Else
>>> * nope
>>> Endif
>>>
>>> Dan
>>>
>>> Dennis Allen wrote:
>>>> Thanks for the reply.
>>>>
>>>> TRY/CATCH? Is there a way to use those commands in VFP6? If not,
>>>> is there another way to head off the OLE error?
>>>>
>>>> "Rolf Lystad" <rolf@invalid.invalid> wrote in message
>>>> news:%23fGSmGF6IHA.616@TK2MSFTNGP02.phx.gbl...
>>>>>
>>>>> local xmlHTTP, cServer
>>>>> cServer = "http://www.microsoft.com"
>>>>> xmlhttp = create("Microsoft.XMLHTTP")
>>>>> xmlhttp.Open("GET", cServer, .f. )
>>>>> TRY
>>>>> xmlhttp.send()
>>>>> ? "OK"
>>>>> CATCH
>>>>> ? "Not OK"
>>>>> ENDTRY
>
>