Getting another web page
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Getting another web page
Just a quickie!!
Im trying to load another webpage with a cgi script, but struggling.
I want to load a page on another server, check it against a copy I have, and if its changed make a log, send an email etc.
I can do it no problem using the put url "xxx" into xxx within the Studio, but this doesnt seem to work in the cgi on the linux server, I assume before the cgi is not v2.8.x
I can do all the rest, sending the email etc.
Any ideas on how to grab another web page and put it into a buffer using the cgi???
Thanks
Andy
Im trying to load another webpage with a cgi script, but struggling.
I want to load a page on another server, check it against a copy I have, and if its changed make a log, send an email etc.
I can do it no problem using the put url "xxx" into xxx within the Studio, but this doesnt seem to work in the cgi on the linux server, I assume before the cgi is not v2.8.x
I can do all the rest, sending the email etc.
Any ideas on how to grab another web page and put it into a buffer using the cgi???
Thanks
Andy
Sure,
A very simple script is...
---- INSIDE REVOLUTION....
on mouseup
put "Content-Type: text/plain" & cr & cr
put "Loading..."
put "http://www.google.com/" into myURL
put URL myURL into myReturn
put myReturn
end mouseup
---- ON THE SERVER
#!/usr/local/revolutioncurrent
on startup
put "Content-Type: text/plain" & cr & cr
put "Loading..."
put "http://www.google.com/" into myURL
put URL myURL into myReturn
put myReturn
end startup
Works fine inside studio, but not on the server. Studio returns all the text and the html for the page, the server just returns 'Loading...'
The path #!/usr/local/revolutioncurrent is correct on my server btw!
Thanks
Andy
A very simple script is...
---- INSIDE REVOLUTION....
on mouseup
put "Content-Type: text/plain" & cr & cr
put "Loading..."
put "http://www.google.com/" into myURL
put URL myURL into myReturn
put myReturn
end mouseup
---- ON THE SERVER
#!/usr/local/revolutioncurrent
on startup
put "Content-Type: text/plain" & cr & cr
put "Loading..."
put "http://www.google.com/" into myURL
put URL myURL into myReturn
put myReturn
end startup
Works fine inside studio, but not on the server. Studio returns all the text and the html for the page, the server just returns 'Loading...'
The path #!/usr/local/revolutioncurrent is correct on my server btw!
Thanks
Andy
Andy,
I have tried it and at the moment I can do no more than confirm that this does't work.
I am able to open sockets to another machines from a remote web server. Depending on what you want to do exactly, that might be an alternative for you.
Best,
Mark
I have tried it and at the moment I can do no more than confirm that this does't work.
I am able to open sockets to another machines from a remote web server. Depending on what you want to do exactly, that might be an alternative for you.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Andy,
I set the timeout to 20 seconds and still nothing happened. In fact, What surprises me is that I don't get an execution error, while the result is also empty after putting the url. There is not timeout error either.
Best,
Mark
I set the timeout to 20 seconds and still nothing happened. In fact, What surprises me is that I don't get an execution error, while the result is also empty after putting the url. There is not timeout error either.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
- Posts: 179
- Joined: Sat Apr 08, 2006 11:08 pm
- Location: London, UK
- Contact:
I think you'd have to have libUrl available for it to work.
It's possibe to separate libUrl out from the IDE, but remember that the cgi engines are still in 'legacy', so you'd hav to put libUrl into a stack and save it in legacy format.
Then you could load it as a library in your cgi:
start using stack "libUrl.rev" (assuming you saved in the same directory as the cgi). This should work, I think.
Best,
Mark
It's possibe to separate libUrl out from the IDE, but remember that the cgi engines are still in 'legacy', so you'd hav to put libUrl into a stack and save it in legacy format.
Then you could load it as a library in your cgi:
start using stack "libUrl.rev" (assuming you saved in the same directory as the cgi). This should work, I think.
Best,
Mark
-
- Posts: 179
- Joined: Sat Apr 08, 2006 11:08 pm
- Location: London, UK
- Contact:
I've tested this now and I'm afraid it doesn't seem to work - my guess is that libUrl is tied in to the engine (I think calls like 'get url "someUrl" go to the engine which then calls libURL, and it seems like this doesn't work with the cgi engines).
The other option is to use curl - this seems to work fine.
On OS X (which has curl installed by default), the call would be:
get shell("curl -s " & "http://www.somesite")
I'm afraid I don't know if this will be helpful on Windows.
Best,
Mark
The other option is to use curl - this seems to work fine.
On OS X (which has curl installed by default), the call would be:
get shell("curl -s " & "http://www.somesite")
I'm afraid I don't know if this will be helpful on Windows.
Best,
Mark