Jump to content

cURL data manipulation


phpSensei

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.