You need to sign in to do that
Don't have an account?

A problem while using Salesforce API
Hello,
I need your help to fix a problem that i have with my application using salesforce API,
I'm using PHP development invironment.
I'm used to send XML request to create/update salesforce objects [leads, contacts or activity history].
And to send the XML request, i have to escape the XML special characters so i can send a valid XML request.
Special characters are like:
- '&' (ampersand) becomes '&'
- '"' (double quote) becomes '"' when ENT_NOQUOTES is not set.
- ''' (single quote) becomes ''' only when ENT_QUOTES is set.
- '<' (less than) becomes '<'
- '>' (greater than) becomes '>'
Note: if i didn't escape these special characters then the request will fail.
The problem is that these special characters aren't mapped back on the server to thier equivalent, i mean if want to set the description of a lead into:
this is a customer description for a lead with these special & " ' < > characters.
Then what i find on Salesforce is:
this is a customer description for a lead with these special & " ' < > characters.
Which doesn't make sense.
Please i need your help on how to fix this issue.
Thanks in advance
eng.imad.atia@gmail.com
if you are using PHP and using an array to update your code, I would use htmlspecialchars on the fields which will convert the values to XML. An example would be if you had an update array called $row you could use:
$row = array_map('stripslashes',$row)
I would also trim your input data:
$row = array_map('trim',array_map('stripslashes',$row));
Hope that helps
~Mike
How were you able to get around this?
Stripslashes has not worked for me and I wondered if you ended up using CDATA.
If you have a sample that you can share using the PHP tookit, I would be very appreciative.
I have My Topic here if you prefer to respond there.
If you have a sample that you can share using the PHP tookit, I would be very appreciative.
I have My Topic here if you prefer to respond there.