{"id":2903,"date":"2012-06-07T23:01:50","date_gmt":"2012-06-07T17:31:50","guid":{"rendered":"http:\/\/JitendraZaa.com\/blog\/?p=2903"},"modified":"2012-06-07T23:01:50","modified_gmt":"2012-06-07T17:31:50","slug":"salesforce-toolkit-for-php","status":"publish","type":"post","link":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/salesforce-toolkit-for-php\/","title":{"rendered":"Salesforce Toolkit for PHP"},"content":{"rendered":"<p style=\"text-align: justify;\">In a web\u00a0development\u00a0PHP has prooved itself as one of the major contributor in the world. There are lots of websites which are built over the PHP and the best example is facebook. PHP is very powerfull, easy to learn and the best thing is that it is open source.<\/p>\n<p style=\"text-align: justify;\">Following the popularity of PHP, salesforce has also started providing support to PHP and delivered the <strong>Toolkit<\/strong> for it. Using this toolkit we can connect with salesforce and perform all API operations supported like Insert, update, delete, retrieve etc.<\/p>\n<p><strong><a href=\"https:\/\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/06\/SFDC-PHP-Toolkit1.zip\">Download Salesforce PHP Toolkit Example &#8211; Zip<!--more--><\/a><\/strong><\/p>\n<p>We can download the toolkit from this URL &#8211; Gits &#8211;<a title=\"PHP Toolkit\" href=\"https:\/\/github.com\/developerforce\/Force.com-Toolkit-for-PHP\" rel=\"nofollow\"> https:\/\/github.com\/developerforce\/Force.com-Toolkit-for-PHP<\/a><\/p>\n<p style=\"text-align: justify;\">In a toolkit downloaded, only important folder is &#8220;<strong>soapclient<\/strong>&#8220;. Copy that folder in your project directory. The Force.com PHP Toolkit requires PHP 5.x with the <a title=\"cURL PHP Module\" href=\"http:\/\/php.net\/manual\/en\/book.curl.php\" rel=\"nofollow\">cURL<\/a>, <a title=\"PHP SOAP Module\" href=\"http:\/\/php.net\/manual\/en\/book.soap.php\" rel=\"nofollow\">SOAP <\/a>and <a title=\"PHP OpenSSL module\" href=\"http:\/\/php.net\/manual\/en\/book.openssl.php\" rel=\"nofollow\">OpenSSL <\/a>PHP modules.<\/p>\n<p style=\"text-align: justify;\">Next step is to download &#8220;<strong>Partner WSDL<\/strong>&#8221; from Salesforce (we have already seen the example of \u00a0Enterprise WSDL so this time i am using Partner WSDL). To download Partner WSDL, Click <strong>Your Name | Setup | Develop | API<\/strong> to display the WSDL download page. Download the Partner WSDL and save as &#8220;PartnerWSDL.xml&#8221;\u009d.<\/p>\n<p>Add below code snippet in your PHP page to retrieve the information from Salesforce using toolkit.<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\ndefine(&quot;USERNAME&quot;, &quot;Your salesforce username&quot;);\ndefine(&quot;PASSWORD&quot;, &quot;salesforce password&quot;);\ndefine(&quot;SECURITY_TOKEN&quot;, &quot;salesforce security token&quot;);\n\nrequire_once ('soapclient\/SforcePartnerClient.php');\n\n$mySforceConnection = new SforcePartnerClient();\n$mySforceConnection-&gt;createConnection(&quot;PartnerWSDL.xml&quot;);\n$mySforceConnection-&gt;login(USERNAME, PASSWORD.SECURITY_TOKEN);\n\n$query = &quot;SELECT Id, FirstName, LastName, Phone from Contact&quot;;\n$response = $mySforceConnection-&gt;query($query);\n\nforeach ($response-&gt;records as $record)\n{\necho '&lt;tr&gt;\n\t&lt;td&gt;'.$record-&gt;Id.'&lt;\/td&gt;\n\t&lt;td&gt;'.$record-&gt;fields-&gt;FirstName.'&lt;\/td&gt;\n\t&lt;td&gt;'.$record-&gt;fields-&gt;LastName.'&lt;\/td&gt;\n\t&lt;td&gt;'.$record-&gt;fields-&gt;Phone.'&lt;\/td&gt;\n\t &lt;\/tr&gt;';\n }\n<\/pre>\n<p style=\"text-align: justify;\">As you can see in above code, we have imported the php file &#8220;<em>SforcePartnerClient.php<\/em>&#8221; which is provided by tookit. Add the UserName, Password and Security token in above code. To access the field from Object use syntax <strong>&#8220;recordset-&gt;fields-&gt;FieldName&#8221;<\/strong>.<br \/>\nThe final output of the example attached in this article would look like:<\/p>\n<figure id=\"attachment_2965\" aria-describedby=\"caption-attachment-2965\" style=\"width: 616px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/06\/force.com-toolkit-for-PHP-toolkit.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\" wp-image-2965 \" title=\"force.com toolkit for PHP toolkit\" src=\"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/06\/force.com-toolkit-for-PHP-toolkit.png?resize=616%2C335&#038;ssl=1\" alt=\"force.com toolkit for PHP toolkit\" width=\"616\" height=\"335\" \/><\/a><figcaption id=\"caption-attachment-2965\" class=\"wp-caption-text\">force.com toolkit for PHP toolkit<\/figcaption><\/figure>\n<p><a href=\"https:\/\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/06\/SFDC-PHP-Toolkit1.zip\">Download Salesforce PHP Toolkit Example &#8211; Zip<\/a><\/p>\n<p><a title=\"Developer force article on PHP toolkit\" href=\"http:\/\/wiki.developerforce.com\/page\/Getting_Started_with_the_Force.com_Toolkit_for_PHP\" rel=\"nofollow\">You can refer this article also on developerforce.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Example of using PHP toolkit in Salesforce with Sample code<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"jz_research_post":"","_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[24,9,19],"tags":[155,331],"class_list":["post-2903","post","type-post","status-publish","format-standard","hentry","category-force-com","category-salesforce","category-webtech","tag-php","tag-salesforce"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":4394,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/create-and-update-records-using-javascript-button-in-salesforce-ajax-toolkit\/","url_meta":{"origin":2903,"position":0},"title":"Create and update records using Javascript button in Salesforce- Ajax Toolkit","author":"Jitendra","date":"April 21, 2015","format":false,"excerpt":"On this blog we have already seen \"how to use Ajax Toolkit to mass update records\" without writing any Apex code. In this article as well, we will use Ajax Toolkit to add custom button in Account page layout and update record. There are endless possibilities and use-cases where this\u2026","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Update Record using Javascript","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/04\/Update-Record-using-Javascript.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/04\/Update-Record-using-Javascript.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/04\/Update-Record-using-Javascript.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/04\/Update-Record-using-Javascript.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":7044,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/limitations-of-lwc\/","url_meta":{"origin":2903,"position":1},"title":"Limitations of LWC","author":"Jitendra","date":"April 22, 2020","format":false,"excerpt":"Considerations & Limitations of Lightning Web Component in Salesforce","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"LWC Not Supported","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2020\/04\/LWC-Not-Supported.png?fit=1200%2C569&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2020\/04\/LWC-Not-Supported.png?fit=1200%2C569&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2020\/04\/LWC-Not-Supported.png?fit=1200%2C569&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2020\/04\/LWC-Not-Supported.png?fit=1200%2C569&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2020\/04\/LWC-Not-Supported.png?fit=1200%2C569&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":3299,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/create-simple-mass-delete-button-for-listview-using-javascript\/","url_meta":{"origin":2903,"position":2},"title":"Create Simple Mass Delete Button for ListView using Salesforce Ajax Toolkit","author":"Jitendra","date":"May 6, 2013","format":false,"excerpt":"In Many situation, I needed a Mass Delete Kind of button. Where, i can select records in ListView and simply click \"Delete\" button. In this example, we will create a simple List View button and add on \"Search Layout\" of that object. So, create a new Custom Button with following\u2026","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Salesforce Mass Delete Button - List View","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2013\/05\/Salesforce-Mass-Delete-Button-List-View.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2013\/05\/Salesforce-Mass-Delete-Button-List-View.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2013\/05\/Salesforce-Mass-Delete-Button-List-View.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":6209,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/how-to-retrieve-and-deploy-custom-metadata-types-using-ant\/","url_meta":{"origin":2903,"position":3},"title":"How to Retrieve and Deploy Custom Metadata Types using ANT","author":"Jitendra","date":"August 27, 2017","format":false,"excerpt":"Using Salesforce ANT Migration toolkit to retrieve and deploy custom metadata types with record. Sample Package.xml and ANT script included.","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Sample of Package.xml to deploy Custom Metadata Types","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/08\/Sample-of-Package.xml-to-deploy-Custom-Metadata-Types.png?fit=1051%2C330&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/08\/Sample-of-Package.xml-to-deploy-Custom-Metadata-Types.png?fit=1051%2C330&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/08\/Sample-of-Package.xml-to-deploy-Custom-Metadata-Types.png?fit=1051%2C330&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/08\/Sample-of-Package.xml-to-deploy-Custom-Metadata-Types.png?fit=1051%2C330&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/08\/Sample-of-Package.xml-to-deploy-Custom-Metadata-Types.png?fit=1051%2C330&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":6951,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/mastering-visual-studio-and-salesforce-dx\/","url_meta":{"origin":2903,"position":4},"title":"Mastering Visual Studio and Salesforce DX","author":"Jitendra","date":"January 14, 2020","format":false,"excerpt":"3.5 hours of video to become Master on using and navigating Visual Studio, Need of scratch org and building modular application using Unlocked Packages","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Salesforce DX on Udemy","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2020\/01\/Salesforce-DX-on-Udemy.png?fit=1200%2C693&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2020\/01\/Salesforce-DX-on-Udemy.png?fit=1200%2C693&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2020\/01\/Salesforce-DX-on-Udemy.png?fit=1200%2C693&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2020\/01\/Salesforce-DX-on-Udemy.png?fit=1200%2C693&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2020\/01\/Salesforce-DX-on-Udemy.png?fit=1200%2C693&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":2835,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/salesforce-apex-code-talk-important-questions-and-answers\/","url_meta":{"origin":2903,"position":5},"title":"Salesforce Apex Code talk &#8211; Important Questions and Answers","author":"Jitendra","date":"May 3, 2012","format":false,"excerpt":"Salesforce Apex Code talk on - 24-April-2012 , Important Interview Questions","rel":"","context":"In &quot;Apex&quot;","block_context":{"text":"Apex","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/apex\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/2903","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/comments?post=2903"}],"version-history":[{"count":0,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/2903\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/media?parent=2903"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/categories?post=2903"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/tags?post=2903"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}