hi, i am trying to take the page source from a 3rd party site. it works fine. but the page source is printed in my page from which i am calling below code. <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://somesite.com/test.htm"); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $data = curl_exec($ch); //execute the funcion now with above settings. curl_close($ch); //manipulating the out put of curl $start=strpos($data,"<strong class=\"downloads\">"); $start2=strpos($data,"</strong>",($start + 26)); //grabbing a piece of string echo rtrim(ltrim(substr($data,$start,$start2))); ?> Code (markup): now i need to stop the printing of the source of the destination in my page. i just tried making curl_setopt($ch, CURLOPT_RETURNTRANSFER, false); then the latter string manipulation part returns nothing.
returntransfer needs to be true as it was in your original script. My guess is your substr thingamagic isn't working and it's simply displaying everything. Remove the last echo (add //) then refresh and see if it's still outputting. If it's not, then your substr is at fault and can't find the piece of string you are trying to find. You should account for this by checking if strpos === false.