[squeak-dev] Curl

danil osipchuk danil.osipchuk at gmail.com
Mon Aug 18 08:09:48 UTC 2008


Steve hello,

Although I've written the curl plugin I'm no expert in http protocol
(redirects, posts etc)..
My shot: you may try to ask curl to follow redirects as in the example below
(not onFollowLocation switch):

c := Curl new.
c onFollowLocation.
c url: 'http://www.archive.org/advancedsearch.php/searchresults.php'.
c clearContents; contents:
'q=title:dodgers&fmt=xml&rows=50&fl=identifier&indent=&xmlsearch=Search'.
c post.
c contents.


I'm getting something like this. If it is not what you need, could you
please explain correct behaviour so I may able to fix it?

q=title:dodgers&fmt=xml&rows=50&fl=identifier&indent=&xmlsearch=Search<?xml
version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader"><int name="status">0</int><int
name="QTime">99</int><lst name="params"><str name="wt">xml</str><str
name="rows">50</str><str name="indent"/><str
name="qin">title:dodgers</str><str name="q">title:dodgers</str><str
name="fl"/></lst></lst><result name="response" numFound="8" start="0"
maxScore="6.4772797"><doc><float name="score">6.4772797</float><float
name="avg_rating">0.0</float>...........

Regards,
  Danil

2008/8/16 Steven W Riggins <mailinglists at geeksrus.com>

> Is anyone using the curl plugin from:
>
> http://wiki.squeak.org/squeak/5865
>
> I am trying to do a post to a site that redirects, but I see two anomalies:
>
>
> 1) the contents remain in the contents buffer, so that tells me I am doing
> posts incorrectly
> 2) I just get the http page back, not the results of the post
>
> I tried this with another form and it posted ok, but I did get the post in
> the contents buffer as well.
>
> The following command to curl works as desired:
>
> curl -d "q=title:help&fmt=xml&rows=50&fl=identifier&xmlsearch=Search"
> http://www.archive.org/advancedsearch.php/searchresults.php
>
> but:
>
> c := Curl new.
> c url: 'http://www.archive.org/advancedsearch.php/searchresults.php'
> c clearContents; contents:
> 'q=title:dodgers&fmt=xml&rows=50&fl=identifier&indent=&xmlsearch=Search'
> c post
>
> returns:
>
> 'q=title%3Adodgers&fmt=xml&rows=50&fl=identifier&indent=&xmlsearch=Search'
>
> ie, the post failed.
>
> Steve
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20080818/25887db1/attachment.htm


More information about the Squeak-dev mailing list