I am working with the Zoho CRM api and I was able to extract the product ID when only inserting one product, but can't figure out how to do it with multiple products. https://www.zoho.com/crm/help/api/insertrecords.html#Insert_Multiple_records
I convert the response to simpleXMLElement and I can get the first product ID easily with:
...curl stuff
$data = curl_exec($ch);
$xml = new SimpleXMLElement($data);
$product_id = $xml->result->recorddetail->FL[0];
The question is if I have multiple product ID's sent back how would I get each one in a loop as my code will only return the first product ID successfully. This is an example of the response from 2 products inserted in the api and the returned response:
SimpleXMLElement Object ( [@attributes] => Array ( [uri] =>
/crm/private/xml/Products/insertRecords ) [result] => SimpleXMLElement
Object ( [message] => Record(s) added successfully [recorddetail] => Array (
[0] => SimpleXMLElement Object ( [FL] => Array ( [0] => **2389399000000122065**
[1] => 2017-03-12 21:33:50 [2] => 2017-03-12 21:33:50 [3] =>
SimpleXMLElement Object ( [@attributes] => Array ( [val] => Created By ) )
[4] => SimpleXMLElement Object ( [@attributes] => Array ( [val] => Modified
By ) ) ) ) [1] => SimpleXMLElement Object ( [FL] => Array ( [0] =>
**2389399000000122066** [1] => 2017-03-12 21:33:50 [2] => 2017-03-12 21:33:50
[3] => SimpleXMLElement Object ( [@attributes] => Array ( [val] => Created
By ) ) [4] => SimpleXMLElement Object ( [@attributes] => Array ( [val] =>
Modified By ) ) ) ) ) ) )
Not sure if it shows up in bold but the two values enclosed in ** ** is what I am looking to extract.