cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: POSTing '*' (with PHP)

From: Sergej Rinc <sergej_at_rinc.ws>
Date: Sun, 18 Feb 2001 00:56:28 +0100

  Thanks for your help, Daniel. Just a clarification here:

----- Original Message -----
> > I use latest PHP and latest curl. After testing I see that in
> > culr_setopt ($ch, CURLOPT_POSTFIELDS, $postString)
> > my postString (urlencoded string of parameters and values properly
> > formatted as in GET URLs) includes this
> >
> > ...?name=%27%2A%27?...
> >
> > e.g. urlencoded '*' string but I get responses from the server that
> > this field is empty. Of course non-urlencoded string is not the answer
> > (it cannot be!). Where could be the problem?
>
> I'll give you exactly the answer you don't want:
>
> This is not exactly a libcurl problem. Curl posts *exactly* the data you
pass
> to it. Curl never encodes any data for you in that way.
>
> Someone is encoding that data before it is passed to libcurl. I'd say that
> someone is either you, the phpcurl module or someone else!

  Yes, the first one is correct. GET and POST parameter values must be
url-encoded and I do parse $HTTP_POST_VARS into list and construct a proper
url-encoded string of parameters and their values.

  This couldn't let me relax today and after several tests now I am now
convinced that it must be a PHP 'feature'. If I call

/usr/local/bin/curl -m 120 -d "...&name=%27%2A%27&..." my_url -L

  (parts removed) from shell I do get a correct response from server. Even

/usr/local/bin/curl -m 120 -d "...&name='*'&..." my_url -L

  works. But in PHP neither setting curl options neither calling exec with
the first line above doesn't work, e.g. looks like form parameters are not
passed from PHP to curl.

  I guess proper question(s) is then - regarding control characters -:

"How to escape percentage sign when calling shell (bash, from PHP) and how
to escape percentage sign when passing strings in PHP?"

  Yes, probably not the right mailing list now ... <g>. I have given up
searching PHP online docs and various sites regarding this issue because I
don't find anything.

> > Any PHP-er to the rescue?
>
> ... you just made my idea of a separate special-purpose curl-php mailing
list
> sound more attractive... :-) Anyone else in favour?

  Well, it might be useful. I just want to do a search wrapper for telephone
numbers in our country by querying all phone and mobile operators phonebooks
on their websites and have read about curl, installed and started to use it
on this Friday ... If PHP won't help me I might look for a solution in Perl.
Anyway, from working with curl from Friday, I can only say that curl is one
of the best open-source tools for webmasters and others.

  Sergej,
  sergej@rinc.ws, http://sergej.rinc.ws
Received on 2001-02-18