Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

IF statement based on different website content

LEGEND ,
Dec 04, 2007 Dec 04, 2007
Hi guys,

Another question for you.....

I would like to implement a system whereby someone will get a free listing
on my site IF they include a chunk of code/widget/cookie on their page. I
would collect the URL to this page at sign-up stage.

Is there a way to make it work so that, upon accessing their entry, the code
'looks up' their page (on their own website) to see if the code is there. If
so, it displays their details. If not, it returns a message like 'record not
found'?

Any help is appreciated.

Darren


TOPICS
Server side applications
348
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 04, 2007 Dec 04, 2007
"Mintyman" <mintyman@ntlworld.com> wrote in message
news:fj3ok3$622$1@forums.macromedia.com...
> Hi guys,
>
> Another question for you.....
>
> I would like to implement a system whereby someone will get a free listing
> on my site IF they include a chunk of code/widget/cookie on their page. I
> would collect the URL to this page at sign-up stage.
>
> Is there a way to make it work so that, upon accessing their entry, the
> code
> 'looks up' their page (on their own website) to see if the code is there.
> If
> so, it displays their details. If not, it returns a message like 'record
> not
> found'?
>
> Any help is appreciated.
>
> Darren

You should retrieve the content from the url provided and search it for your
code.
For creating search patterns you can use a language called "Regular
Expressions", most scripting/programming languages support regular
expressions in one way or another, it depends on your server setup which
language you use.
It might make sense to check for the existence of the code fragment
periodically instead of each time page is visited and store the result in a
database of sorts so your server doesn't consume bandwidth unnecessarily.



Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 04, 2007 Dec 04, 2007
How exactly do I retrieve the content from the other URL though?

Basically, I will want users to place a snippet code (probably an image and
a link to my website) on their page in order to get a free listing so I will
know the exact code to look for. The bit i'm stuck with is HOW to actually
retrieve the data and search it.

"Joris van Lier" <whizzrd@hotmail.com> wrote in message
news:fj42vb$gd5$1@forums.macromedia.com...
> "Mintyman" <mintyman@ntlworld.com> wrote in message
> news:fj3ok3$622$1@forums.macromedia.com...
>> Hi guys,
>>
>> Another question for you.....
>>
>> I would like to implement a system whereby someone will get a free
>> listing
>> on my site IF they include a chunk of code/widget/cookie on their page. I
>> would collect the URL to this page at sign-up stage.
>>
>> Is there a way to make it work so that, upon accessing their entry, the
>> code
>> 'looks up' their page (on their own website) to see if the code is there.
>> If
>> so, it displays their details. If not, it returns a message like 'record
>> not
>> found'?
>>
>> Any help is appreciated.
>>
>> Darren
>
> You should retrieve the content from the url provided and search it for
> your code.
> For creating search patterns you can use a language called "Regular
> Expressions", most scripting/programming languages support regular
> expressions in one way or another, it depends on your server setup which
> language you use.
> It might make sense to check for the existence of the code fragment
> periodically instead of each time page is visited and store the result in
> a database of sorts so your server doesn't consume bandwidth
> unnecessarily.
>
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 04, 2007 Dec 04, 2007
"Mintyman" <mintyman@ntlworld.com> wrote in message
news:fj47tv$lpk$1@forums.macromedia.com...
> How exactly do I retrieve the content from the other URL though?
>
> Basically, I will want users to place a snippet code (probably an image
> and a link to my website) on their page in order to get a free listing so
> I will know the exact code to look for. The bit i'm stuck with is HOW to
> actually retrieve the data and search it.

What ServerModel are you using? (PHP/ASP/ASP.NET ColdFusion)


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 04, 2007 Dec 04, 2007
Hi Joris,

Thanks for your input so far.

I have managed to find a solution that words. Yay! I'm using ASP VBScript.

In case anyone out there wants to know what worked, here's the code I used :

<%
' Url of the webpage we want to retrieve
thisURL = " http://www.mysite.com"

' Creation of the xmlHTTP object
Set GetConnection = CreateObject("Microsoft.XMLHTTP")

' Connection to the URL
GetConnection.Open "get", thisURL, False
GetConnection.Send

' ResponsePage now have the response of
' the remote web server
dim varText
varText = GetConnection.responseText

Set GetConnection = Nothing
%>

<%
'Use logic to control content
If Instr(1, varText, "search text goes here") > 0 Then %>
Link Found
<%Else%>
Link Not Found
<%End If%>

All I need to do is work out how to get it to poll the remote website
periodically as per your suggestion. I will need this to run on a remotely
hosted account on which I don't have access to the O/S. I'm using MS Access
as a back-end.

Any ideas?


"Joris van Lier" <whizzrd@hotmail.com> wrote in message
news:fj48ql$mmp$1@forums.macromedia.com...
> "Mintyman" <mintyman@ntlworld.com> wrote in message
> news:fj47tv$lpk$1@forums.macromedia.com...
>> How exactly do I retrieve the content from the other URL though?
>>
>> Basically, I will want users to place a snippet code (probably an image
>> and a link to my website) on their page in order to get a free listing so
>> I will know the exact code to look for. The bit i'm stuck with is HOW to
>> actually retrieve the data and search it.
>
> What ServerModel are you using? (PHP/ASP/ASP.NET ColdFusion)
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 04, 2007 Dec 04, 2007


"Mintyman" <mintyman@ntlworld.com> wrote in message
news:fj4937$n3h$1@forums.macromedia.com...
> Hi Joris,
>
> Thanks for your input so far.
>
> I have managed to find a solution that words. Yay! I'm using ASP VBScript.
>
> In case anyone out there wants to know what worked, here's the code I used
> :
>
> <%
> ' Url of the webpage we want to retrieve
> thisURL = " http://www.mysite.com"
>
> ' Creation of the xmlHTTP object
> Set GetConnection = CreateObject("Microsoft.XMLHTTP")

It's recommended to use ServerXMLHTTP when working on servers
http://support.microsoft.com/kb/303982


> ' Connection to the URL
> GetConnection.Open "get", thisURL, False
> GetConnection.Send
>
> ' ResponsePage now have the response of
> ' the remote web server
> dim varText
> varText = GetConnection.responseText
>
> Set GetConnection = Nothing
> %>
>
> <%
> 'Use logic to control content
> If Instr(1, varText, "search text goes here") > 0 Then %>
> Link Found
> <%Else%>
> Link Not Found
> <%End If%>

InStr should work with simple code fragments, as soon as the user, or their
editor starts reformatting your code, it will break down, a regular
expression allows for more flexibility in the pattern

> All I need to do is work out how to get it to poll the remote website
> periodically as per your suggestion. I will need this to run on a remotely
> hosted account on which I don't have access to the O/S. I'm using MS
> Access as a back-end.
>
> Any ideas?

On *nix servers it's quite common to have cron capability, on windows this
option is offererd less, Try asking your host about "cron" or "Scheduling
Tasks", they may be able to help you out.

There are free services that allow calling an url, never tried it
http://scheduler.webgrid.com/

You can use your machine at home or at the office call the url via Windows
Task scheduler or cron on OS X or Linux



Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 04, 2007 Dec 04, 2007
LATEST
Joris, you're a star! I'm away to do some homework........

"Joris van Lier" <whizzrd@hotmail.com> wrote in message
news:fj4af8$ojb$1@forums.macromedia.com...
>
>
> "Mintyman" <mintyman@ntlworld.com> wrote in message
> news:fj4937$n3h$1@forums.macromedia.com...
>> Hi Joris,
>>
>> Thanks for your input so far.
>>
>> I have managed to find a solution that words. Yay! I'm using ASP
>> VBScript.
>>
>> In case anyone out there wants to know what worked, here's the code I
>> used :
>>
>> <%
>> ' Url of the webpage we want to retrieve
>> thisURL = " http://www.mysite.com"
>>
>> ' Creation of the xmlHTTP object
>> Set GetConnection = CreateObject("Microsoft.XMLHTTP")
>
> It's recommended to use ServerXMLHTTP when working on servers
> http://support.microsoft.com/kb/303982
>
>
>> ' Connection to the URL
>> GetConnection.Open "get", thisURL, False
>> GetConnection.Send
>>
>> ' ResponsePage now have the response of
>> ' the remote web server
>> dim varText
>> varText = GetConnection.responseText
>>
>> Set GetConnection = Nothing
>> %>
>>
>> <%
>> 'Use logic to control content
>> If Instr(1, varText, "search text goes here") > 0 Then %>
>> Link Found
>> <%Else%>
>> Link Not Found
>> <%End If%>
>
> InStr should work with simple code fragments, as soon as the user, or
> their editor starts reformatting your code, it will break down, a regular
> expression allows for more flexibility in the pattern
>
>> All I need to do is work out how to get it to poll the remote website
>> periodically as per your suggestion. I will need this to run on a
>> remotely hosted account on which I don't have access to the O/S. I'm
>> using MS Access as a back-end.
>>
>> Any ideas?
>
> On *nix servers it's quite common to have cron capability, on windows this
> option is offererd less, Try asking your host about "cron" or "Scheduling
> Tasks", they may be able to help you out.
>
> There are free services that allow calling an url, never tried it
> http://scheduler.webgrid.com/
>
> You can use your machine at home or at the office call the url via Windows
> Task scheduler or cron on OS X or Linux
>
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines