What are the differences between form posts and cURL requests?

I am trying to send data to SalesForce.com, but I would like to do it through AJAX. Since there are restrictions to contain XSS, I have jQuery using AJAX to submit to a PHP page on my server, and then with this page just send the form data that it submitted to the correct URL.

If I submit the form with JS turned off, everything will go fine. If I turn it on, Salesforce will confirm receipt of the data (in debug mode), but it does not appear in my queue or anywhere really, in SF. SF discards all the fields that it passed, and discards all the fields that I have in my form correctly filled.

Are there any differences between sending something using this method (jQuery $.ajax() in PHP cURL) and using the built-in HTML submit button? Something that can make SF log data, but log it differently? I tried to add the information CURLOPT_HEADER / CURLOPT_HTTPHEADER

+3
source share
3 answers

Well, the only thing you cannot fake is the request IP address. Depending on how tight the protection is used by Salesforce, you will not be able to spoof a single IP address (it will detect and reject the request).

Everything else should be 100% fake (headers, etc.). I would suggest that you get firebug or TamperData and look at the original headers sent to salesforce from your browser. Then repeat this exact request with PHP. If you need other information, you can find it in JS and pass it to PHP (cookie information, browser information, etc.) ...

+2
source

$. ajax () transfers cookies from the client’s browser; and it also adds the request header "X-Requested-With: XMLHttpRequest".

0
source

Perhaps try adding the (external) IP address of the machine running the PHP code to the list of trusted networks in salesforce. Log in to salesforce and go to settings -> security controls -> network access and add IP there.

I had a similar problem and I had to add the IP address of the server running the java application related to sf and this fixed the problem for me.

0
source

All Articles