Title: Response code bug
Last modified: August 20, 2016

---

# Response code bug

 *  Resolved [Anton Timmermans](https://wordpress.org/support/users/atimmer/)
 * (@atimmer)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/response-code-bug/)
 * Hello,
 * I have found a bug in the gravity forms salesforce add-on. With no better place
   to post it I post it here.
 * When I tried to activate my clients salesforce organization ID I got the nice
   message: “Salesforce.com is temporarily unavailable. Please try again in a few
   minutes.”. Which wasn’t true ofcourse, so I decided to dig in the code.
 * What I found was that salesforce correctly returns a response but it wasn’t handled
   correctly. The line that checks this is line 456 in salesforce.php:
 *     ```
       if(wp_remote_retrieve_response_code($result) !== 200) { // Server is down.
       ```
   
 * In the [codex](http://codex.wordpress.org/Function_API/wp_remote_retrieve_response_code)
   for ‘wp_remote_retrieve_response_code’ it states that this function returns a
   string, in my investigation I have found that wordpress return a string or an
   integer, for me depending on the environment (different servers yield different
   results).
 * So this line should be rewritten to either one of these to fix the bug:
 *     ```
       if(wp_remote_retrieve_response_code($result) != 200) { // Server is down.
       ```
   
 * or
 *     ```
       $res_code = wp_remote_retrieve_response_code($result);
       if($res_code !== 200 && $res_code !== '200') { // Server is down.
       ```
   
 * Depending on what best fits your goal with that line of code.
 * I hope I have provided you with enough detail to quickly fix this bug so I don’t
   have to be afraid an update overwrites this fix.
 * PS. I guess this should solve the following tickets as well:
    [http://wordpress.org/support/topic/plugin-gravity-forms-salesforce-add-on-salesforcecom-is-temporarily-unavailable-please-try-again-in-a-few-minutes?replies=2](http://wordpress.org/support/topic/plugin-gravity-forms-salesforce-add-on-salesforcecom-is-temporarily-unavailable-please-try-again-in-a-few-minutes?replies=2)
   [http://wordpress.org/support/topic/web-to-lead-salesforcecom-is-temporarily-unavailable-please-try-again-in-a-f](http://wordpress.org/support/topic/web-to-lead-salesforcecom-is-temporarily-unavailable-please-try-again-in-a-f)
 * [http://wordpress.org/extend/plugins/gravity-forms-salesforce/](http://wordpress.org/extend/plugins/gravity-forms-salesforce/)

Viewing 1 replies (of 1 total)

 *  Plugin Contributor [Zack Katz](https://wordpress.org/support/users/katzwebdesign/)
 * (@katzwebdesign)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/response-code-bug/#post-3489062)
 * Thanks [@atimmer](https://wordpress.org/support/users/atimmer/), I’m releasing
   a fix based on your code. Very helpful indeed! 🙂

Viewing 1 replies (of 1 total)

The topic ‘Response code bug’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/gravity-forms-salesforce_fbfdff.svg)
 * [Gravity Forms Salesforce Add-on](https://wordpress.org/plugins/gravity-forms-salesforce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gravity-forms-salesforce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gravity-forms-salesforce/)
 * [Active Topics](https://wordpress.org/support/plugin/gravity-forms-salesforce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gravity-forms-salesforce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gravity-forms-salesforce/reviews/)

## Tags

 * [GravityForms](https://wordpress.org/support/topic-tag/gravityforms/)

 * 1 reply
 * 2 participants
 * Last reply from: [Zack Katz](https://wordpress.org/support/users/katzwebdesign/)
 * Last activity: [13 years, 5 months ago](https://wordpress.org/support/topic/response-code-bug/#post-3489062)
 * Status: resolved