phpSensei Posted July 30, 2009 Share Posted July 30, 2009 This is regex related. See I am using regex to send HTTP post to a PHP file on another server giving me back a certain set of information. For example I am sending the Year, Make, Model..etc of a car and getting back the price of the car, or its part. Part of the HTML returned by the cURL exec is <br>Estimated Parts: $237.99<br> Which is in the middle of other tags like <td>, <img>..etc I want to wrap a bbcode ([ b ] [ b ] ) around it. so far I have <?php $output= curl_exec ($ch); $output = preg_replace("/(\<br \/\>)(Estimated Parts\:[\S\s])(.+)(\<br \/\>)/","[b]\\3[/b]",$output); ?> Thats only part of the code, but it wraps the string with the bold codes, but leaves out the PRICE Link to comment https://forums.phpfreaks.com/topic/168121-curl-data-manipulation/ Share on other sites More sharing options...
phpSensei Posted July 31, 2009 Author Share Posted July 31, 2009 bump, im a noob on regex lol Link to comment https://forums.phpfreaks.com/topic/168121-curl-data-manipulation/#findComment-887382 Share on other sites More sharing options...
.josh Posted July 31, 2009 Share Posted July 31, 2009 $string = preg_replace('~<br\s?/?>([^<]*Estimated Parts:[^<]+)<br\s?/?>~is','[b]$1[/b]',$string); Link to comment https://forums.phpfreaks.com/topic/168121-curl-data-manipulation/#findComment-887384 Share on other sites More sharing options...
phpSensei Posted July 31, 2009 Author Share Posted July 31, 2009 $string = preg_replace('~<br\s?/?>([^<]*Estimated Parts:[^<]+)<br\s?/?>~is','[b]$1[/b]',$string); Much appreciated CV. Its a shame I didn't know this, I will take some time off this site and freakin learn it. Chao Link to comment https://forums.phpfreaks.com/topic/168121-curl-data-manipulation/#findComment-887386 Share on other sites More sharing options...
phpSensei Posted July 31, 2009 Author Share Posted July 31, 2009 edit: delete this Link to comment https://forums.phpfreaks.com/topic/168121-curl-data-manipulation/#findComment-887422 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.