Can Rev as CGI pull an URL's HTML into a variable?

Jim Ault JimAultWins at yahoo.com
Wed Aug 16 18:43:48 EDT 2006


On 8/16/06 11:17 AM, "Andre Garzia" <soapdog at mac.com> wrote:
> Rob,
> try:
> 
> pput $QUERY_STRING into searchstring
>>>   put "http://www.imdb.com/find?s=tt&q=" & searchstring into
>>> searchURL
>>>   put shell("curl" && searchURL) into databack
> 
> beware that curl will put more data in the answer such as transfer
> time. You'll need to use lineoffset to find where to start.
> 
Instead, use the -s switch so you won't have to use lineoffset
----------------
Two notes about 'curl' (in order to go     'see a URL'), get it...

    curl  -s -k -d  'formdataOrQueryToSend'
'http://remote.com/fldr/this/proc.php'
(use s k d in this order to get them all to work)

-s/--silent
Silent mode. Don't show progress meter or error messages. Makes Curl mute.

k/--insecure
(SSL) This option explicitly allows curl to perform "insecure" SSL
connections and transfers.  Result == you don't need a certificate for this
IP, since it is a trusted IP.

d/--data <data>
(HTTP) Sends the specified data in a POST request to the HTTP server, in a
way that can emulate as if a user has filled in a HTML form and pressed the
submit button. 

-----note 2 ---------------------
I recently found that with the 'curl' command that the query string can be
too long and OSX will return a two-line error message:

/bin/sh: line 1: unexpected EOF while looking for matching `''
/bin/sh: line 35: syntax error: unexpected end of file


Hope this helps.

Jim Ault
Las Vegas
 
> 
> On Aug 16, 2006, at 2:54 PM, RGould8 at aol.com wrote:
> 
>> Hmmm, I'm afraid I'm having the same problem, using the script you
>> provided.
>>  I do get 90% of the html, but the loading process just hangs.
>> 
>> Server:   Mac OS X Tiger 10.4
>> Client:   Safari or Firefox
>> 
>> Could it be something with Mac OS X?
>> 
>> 
>> In a message dated 8/16/06 3:34:31 AM, dcragg at lacscentre.co.uk writes:
>> 
>> 
>>> 
>>> On 16 Aug 2006, at 04:49, rgould8 at aol.com wrote:
>>> 
>>>> 
>>>> When I run the below script as a CGI, I get, maybe 90% of the html
>>>> back, but it hangs at the end for some reason.  Is there a
>>>> character-limit to how much text libURL can retrieve at once?
>>> 
>>> There's no limit.
>>> 
>>> As a first step, I'd suggest you retrieve the url before you starting
>>> sending back any response from your CGI. Something like this
>>> (untested):
>>> 
>>> #!revolution
>>> 
>>> on startup
>>> 
>>>   start using stack "liburl_1.1.5_minus.rev"
>>> 
>>>   put $QUERY_STRING into searchstring
>>>   put "http://www.imdb.com/find?s=tt&q=" & searchstring into
>>> searchURL
>>>   put URL searchURL into databack
>>>   if the result <> empty then ##error occurred
>>>    put "error" && the result into databack
>>>   end if
>>> 
>>>   put "parameter   = " & urlDecode($QUERY_STRING) into tRet
>>>   put cr & "databack = " & databack after tRet
>>> 
>>>   put "Content-Type: text/plain" & cr
>>>   put "Content-Length:" & length(tRet) & cr & cr
>>> 
>>>   put tRet
>>> 
>>>   wait 20 milliseconds ##helps with some servers
>>>   end startup
>>> 
>>> If this still has problems, let us know.
>>> 
>>> Cheers
>>> Dave
>>> _______________________________________________
>>> use-revolution mailing list
>>> use-revolution at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription
>>> preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>> 
>>> 
>> 
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution





More information about the use-livecode mailing list