Soap Response - how to grab contents of one part

I have a soap response i wish to just extract what is in between the following brackets


<ns1:InsuranceGroup>1</ns1:InsuranceGroup>

what would the best way be.

the whole response comes back from a curl and is called $response as it’s variable.

Is there any reason why you’re using cURL, rather than something like PHP’s SoapClient?

just using it as a test at the moment.

can any one help do a pregmatch for it instead?

Why not show us what you have so far, and folks can help you to make it work the way you want? (:

$string = '<ns1:InsuranceGroup>1</ns1:InsuranceGroup>';
preg_match('#<ns1:InsuranceGroup>(.+?)</ns1:InsuranceGroup>#',$string,$match);
$data = $match[1];
echo '<p>', $data, '</p>';

Thank you that has worked :slight_smile:

i need to try do a multiple match now to echo out some results

i have the following

                                                    <ns1:Make>
								
								<ns1:Description>BMW</ns1:Description>
							</ns1:Make>
							<ns1:Model>
								
								<ns1:Description>6 SERIES</ns1:Description>
							</ns1:Model>
							<ns1:Body>
								<ns1:Description>5 Door Hatchback</ns1:Description>
							</ns1:Body>
							<ns1:Transmission>
                                                         <ns1:Description>5 Speed Manual Petrol</ns1:Description>
							</ns1:Transmission>

is there any easy way to extract the make and model and transmission from the returned values there?

i altered the code above to look for description but now i am stuck as it’s hitting about 6 options of description now

think i have sorted it now :slight_smile: