curl-and-php
Re: Problem with new line
Date: Sun, 9 Mar 2003 21:40:46 +0100
I actually fixed this. But really dont know why it works now.
Dont know if this is relevant information but I develop the script in a Windows 2000 environment and the file itself (and the webserver) is on a freebsd 4.7 machine with apache 1.3.27 and php 4.3.0, curl-version is: libcurl 7.9.8 (OpenSSL 0.9.6g) (ipv6 enabled).
Now, I did some trial and error and added this line:
$test = str_replace("\n"," ",$POST['text']);
And then i use $test instead of $POST['text']. That fixed everything. It feels like a ugly solution but i'll use it until i come up with something better.
/Per Sandberg
----- Original Message -----
From: "Daniel Stenberg" <daniel_at_haxx.se>
To: "curl and php list" <curl-and-php_at_lists.sourceforge.net>
Sent: Sunday, March 09, 2003 8:18 PM
Subject: Re: Problem with new line
On Sat, 8 Mar 2003, Per Sandberg wrote:
> When i use the -F option with curl it doesnt seem to send anything after a
> new line in a <textarea>.
What curl version on what operating system?
> The site i am posting my data to only displays the first line from the
> <textarea>
>
> this is the whole string i use exec(); on:
>
> $cmd = '/usr/local/bin/curl -e -F "txtName='.$POST["name"].'" -F
> "txtPhone='.$POST["phone"].'" -F "txtEmail='.$POST["email"].'" -F
> "sltNew_Zon='.$region[7].'" -F "txtCity='.$POST["subrgn"].'" -F
> "txtMode='.$type[7].'" -F "sltNew_Cate='.$category[7].'" -F
> "txtTitle='.$POST["header"].'" -F "txtDesc='.$POST["text"].'" -F
> "txtUrl='.$POST["infolnk"].'" -F "txtNameUrl='.$POST["infotitle"].'" -F
> "userfile='.$data['userfile'].'" -F "txtPassword='.$POST['password'].'" -F
> "submit=Lägg in annons" -e http://www.fyndtorget.se/annons_new.php
> http://www.fyndtorget.se/check.php';
I'd suggest using the --trace option to debug this properly. You can then get
a full dump of the entire request and see what was sent and what wasn't.
I can't recall or find any code in curl that cares about newlines in -F data,
but I suspect that your shell perhaps is playing tricks on you...
> Now everything works fine besides the "txtDesc" which only displays the
> first line on the <textarea>. I have not urlencoded any data as I've
> learned that you shouldnt do that when using "-F".
Correct, -F texts should be sent "binary".
PS, when asking questions about the curl tool, consider using the curl-users
mailing list which is crowded with curl-tool users...
-- Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs. ------------------------------------------------------- This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com ------------------------------------------------------- This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.comReceived on 2003-03-09