{"id":436,"date":"2022-09-22T13:47:51","date_gmt":"2022-09-22T13:47:51","guid":{"rendered":"https:\/\/smppcenter.com\/kb\/?p=436"},"modified":"2022-09-22T13:47:52","modified_gmt":"2022-09-22T13:47:52","slug":"what-is-the-php-sample-code-to-send-bulk-upload-file-using-sms-api","status":"publish","type":"post","link":"https:\/\/smppcenter.com\/kb\/what-is-the-php-sample-code-to-send-bulk-upload-file-using-sms-api\/","title":{"rendered":"What is the PHP Sample Code to Send Bulk Upload File using SMS API?"},"content":{"rendered":"\n<p>You can use the following code and change the default values<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-php\" data-file=\"send-bulk-upload-sms.php\" data-lang=\"PHP\"><code>&lt;?php\n\/\/Change Default values below\n$apiEndpoint = &#39;https:\/\/yourdomaindotcom\/SMSApi\/send&#39;\n$userId = &#39;YourUsername&#39;;\n$password = &#39;YourPassword&#39;;\n$message = &#39;Enter your message here&#39;;\n$senderId - &#39;SMPPCR&#39;;\n$file = new CURLFILE(&#39;\/path\/to\/txt_sample_mobile.txt&#39;, &#39;text\/plain&#39;, &#39;txt_sample_mobile.txt&#39;);\n$dltTemplateId = &#39;1xxxxxxxxxx&#39;;\n\n\/\/Optional parameters\n$apiKey = &#39;&#39;;\/\/optional if you are using password else required\n$dltEntityId = &#39;&#39;;\/\/Optional\n\n\/\/Do not edit from here\n$post = array(&#39;userid&#39; =&gt; $userId,&#39;password&#39; =&gt; $password,&#39;senderid&#39; =&gt; $senderId,&#39;dltEntityId&#39; =&gt; $dltEntityId,&#39;sendMethod&#39; =&gt; &#39;bulkupload&#39;,&#39;file&#39; =&gt; $file, &#39;msgType&#39; =&gt; &#39;text&#39;,&#39;msg&#39; =&gt; $message,&#39;dltTemplateId&#39; =&gt; $dltTemplateId,&#39;output&#39; =&gt; &#39;json&#39;,&#39;duplicatecheck&#39; =&gt; &#39;true&#39;);\n\n$curl = curl_init();\ncurl_setopt_array($curl, array(\n  CURLOPT_URL =&gt; $apiEndpoint,\n  CURLOPT_RETURNTRANSFER =&gt; true,\n  CURLOPT_ENCODING =&gt; &#39;&#39;,\n  CURLOPT_MAXREDIRS =&gt; 10,\n  CURLOPT_TIMEOUT =&gt; 0,\n  CURLOPT_FOLLOWLOCATION =&gt; true,\n  CURLOPT_SSL_VERIFYHOST =&gt; false,\n  CURLOPT_SSL_VERIFYPEER =&gt; false,\n  CURLOPT_HTTP_VERSION =&gt; CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST =&gt; &#39;POST&#39;,\n  CURLOPT_POSTFIELDS =&gt; $post,\n  CURLOPT_HTTPHEADER =&gt; array(\n    &#39;Cookie: PHPSESSID=rk069jiq3n2ifnp0h810ip3gn2&#39;,\n    &quot;apikey: $apiKey&quot;\n  ),\n));\n$response = curl_exec($curl);\ncurl_close($curl);\nprint_r($response);<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Phone File Sample<\/h2>\n\n\n\n<p>You can save the file, txt_sample_mobile.txt, as follows;<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\" data-file=\"txt_sample_mobile.txt\"><code>Phone\n9199999xxxxx\n9199998xxxxx<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>You can use the following code and change the default values Phone File Sample You can save the file, txt_sample_mobile.txt, as follows;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[79],"tags":[235,234,236,80],"class_list":["post-436","post","type-post","status-publish","format-standard","hentry","category-http-rest-sms-api","tag-bulk-upload-sms-api","tag-file-upload-sms","tag-php-sample-code","tag-sms-api"],"_links":{"self":[{"href":"https:\/\/smppcenter.com\/kb\/wp-json\/wp\/v2\/posts\/436","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/smppcenter.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/smppcenter.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/smppcenter.com\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/smppcenter.com\/kb\/wp-json\/wp\/v2\/comments?post=436"}],"version-history":[{"count":0,"href":"https:\/\/smppcenter.com\/kb\/wp-json\/wp\/v2\/posts\/436\/revisions"}],"wp:attachment":[{"href":"https:\/\/smppcenter.com\/kb\/wp-json\/wp\/v2\/media?parent=436"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/smppcenter.com\/kb\/wp-json\/wp\/v2\/categories?post=436"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/smppcenter.com\/kb\/wp-json\/wp\/v2\/tags?post=436"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}