#23539 [Com]: curl_exec seems to produce strange results
| From: | mahesh at mediaibc dot com | Date: | Sat, 17 Jul 2004 10:37:47 +0000 |
| Subject: | #23539 [Com]: curl_exec seems to produce strange results | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-62517@lists.php.net to get a copy of this message | ||
ID: 23539
Comment by: mahesh at mediaibc dot com
Reported By: ramato at squiz dot net
Status: Closed
Bug Type: cURL related
Operating System: Redhat Linux 7.3
PHP Version: 4.3.2RC2
New Comment:
my apache server is not responding & hence the php pages result is not
showing
what to do?
Previous Comments:
------------------------------------------------------------------------
[2004-01-01 17:34:43] hliu at ap dot org
Hi,
I are suffering the curl problem as "The page cannot be displayed"
based on the following code
<?php
$url = 'https://secure.authorize.net/xxxxxx';
$ch = curl_init($url);
echo curl_error($ch);
curl_exec ($ch);
curl_close ($ch);
?>
Do you think I should ask my web hosting provider to fix it or is there
some wrong on my php script?
Thanks,
Willy
------------------------------------------------------------------------
[2003-05-19 09:23:33] sniper@php.net
Now fixed also in the stable branch.
------------------------------------------------------------------------
[2003-05-17 09:12:58] sterling@php.net
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
------------------------------------------------------------------------
[2003-05-15 01:42:26] daniel at haxx dot se
Ok, I've seen users of PHP/CURL mention this before, and for some
reason people tend to assume that the garbage is chunked
transfer-encoding data (which is not true, since libcurl deals with the
chunked data itself and hides that logic from the app).
One user says he solved the problem by using
curl_setopt(curlopt_returntransfer,1)
(http://curl.haxx.se/mail/curlphp-2003-04/0013.html). That could give
you a hint of where to look for this.
Looking at the current ext/curl/interface.c code in CVS, I can only see
a very minor bug that I think doesn't make any difference at this point.
Patch for this follows here:
diff -u -r1.15 interface.c
--- interface.c 9 May 2003 01:10:18 -0000 1.15
+++ interface.c 15 May 2003 06:40:56 -0000
@@ -374,7 +374,7 @@
switch (t->method) {
case PHP_CURL_STDOUT:
- PHPWRITE(data, size);
+ PHPWRITE(data, length);
break;
case PHP_CURL_FILE:
return fwrite(data, size, nmemb, t->fp);
@@ -483,7 +483,7 @@
if (ch->handlers->write->method == PHP_CURL_RETURN) {
smart_str_appendl(&ch->handlers->write->buf, data, (int) length);
} else {
- PHPWRITE(data, size);
+ PHPWRITE(data, length);
}
break;
case PHP_CURL_FILE:
------------------------------------------------------------------------
[2003-05-14 21:03:55] iliaa@php.net
Daniel,
I do not believe it is curl_easy_perform(), who is at fault here, but
the strange text that I can see occurs every single time and definately
is not printed by anything inside PHP. Unfortunately I am not fluent in
libcurl source to give you much more information then that. I did
however write a small scirpt that is the equivalent of the above code
in C (well, it does the same thing) and did not get any strange text.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/23539
--
Edit this bug report at http://bugs.php.net/?id=23539&edit=1