|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-03-15 23:19 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 08:00:01 2025 UTC |
Description: ------------ Reusing a cURL request while using CURLOPT_RETURNTRANSFER=true causes the result of the first curl_exec() to still be in the body of the second curl_exec(). Possibly, buffer isnt being cleared. I cant explain it properly, but the example code below should be able to. This only happens on 4.4.6, and not on 4.4.4 Workaround is to use ob_start(); curl_exec($ch); $data=ob_get_clean(); Reproduce code: --------------- $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_URL, 'www.myjobspace.co.nz'); $data1 = curl_exec($ch); curl_setopt($ch, CURLOPT_URL, 'www.myjobspace.co.nz/search'); $data2 = curl_exec($ch); if (strpos($data2, $data1)===0) { echo 'cURL Buffer is NOT being cleared'; } else { echo 'Everything ok'; } Expected result: ---------------- Everything ok Actual result: -------------- cURL Buffer is NOT being cleared