PHP Frameworks Archives - Page 11 of 13

ACORD Forms autofill

Author - Webner

We get this request from a lot of clients in US insurance industry who want to generate ACORD forms automatically, means they want data of corresponding insurance Policy and other objects filled automatically in the editable ACORD PDF. Most of the clients have their data in a CRM system like Read more…

Zoho Creator or PHP based solution?

Author - Webner

A lot of Zoho users want to extend the capability that Zoho CRM provides out of the box. For example, one of our clients wanted to build a custom Quote Generator. They initially wanted to get the customization done to default Zoho CRM Quote form but their requirements were not Read more…

PHP | Convert date from one format to another in php

Author - Webner

To convert date from one format to another we need to specify to php interpreter the format of our current value. See code below:

/*
In statement below, we are providing date and format to DateTime::createFromFormat function so that function could know day, month and year values separately
*/

$date = DateTime Read more…

PHP | strpos() and result compare

Author - Webner

strpos($wholeText, $findText) in PHP returns position from which the $findText value starts if it is present in $wholeText. If it is not found then this function returns false. Fun starts when text is found at the very beginning (at position 0, as 0 is equivalent to false in PHP Read more…

PHP – Get files modified on a particular date

Author - Kiran Preet

Solution: In following example we have filtered files which are modified on current date (today’s date):
$source= “C:\wamp\www\Files\”;
$files = scandir($source);
$archiveFiles = array();
foreach($files as $file)
{
if (!in_array($file,array(“.”,”..”)))
{
$lastModified = date(‘d/m/y’,filemtime($source . ‘/’ .$file));
IF($lastModified==date(“d/m/y”))
{
array_push Read more…

Using Isset() function in php

Author - Webner

The Isset () Function:

The isset () function is used when we have to check whether a value in the variable is set or not. It returns false when variable contains null values.

For Example, values are stored in a session so that it can have access to another web Read more…

Issues of UTF-8 Encode Keyword

Author - Webner

<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″>

<?php echo utf8_decode(“selecciona una categoría”);?>

Above two lines are used to decode the special characters properly. We use the meta tag in section of the page to decode the whole page and second Read more…

PHP | Sorting Complex Multidimensional Array

Author - Ishpreet Kaur

Suppose we have a complex array like below:

$products = array(
array(
‘product’ => array(‘id’ => 1, ‘name’ => ‘Jquery tutorial book’),
‘product_details’ => array(‘cost’ => 10, ‘edition’ => ‘first’)
),
array(
‘product’ => array(‘id’ => 2, ‘name’ => ‘javascript tutorial book’),
‘product_details’ => array(‘cost’ => 20, ‘edition’ => ‘first’)
),
array(
‘product’ => array(‘id’ => 3, ‘name’ => ‘C++ tutorial book’),
‘product_details Read more…

Selenium | How to test popup alert message in Selenium Webdriver

Author - Webner

Below is the script:
package mypackage;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class myclass
{
public static void main(String[] args)
{
WebDriver driver = new FirefoxDriver();
String alertMessage = “”;
driver.get(“http://demo.webnerserver.com/view/sent_email.php”)
driver.findElement(By.cssSelector Read more…

Mysql | How to access database remotely

Author - Kiran Preet

To access Mysql database remotely a good way is to create a new Mysql user and grant it permissions to access database from remote, as explained below:

You can create user with two ways

From Mysql command prompt:

1. Open command prompt.

2. Open the terminal of MYSQL Read more…

Javascript | Unable to get content of HTML while converting HTML page to PDF

Author - Webner

Problem : Unable to get content of HTML while converting HTML page to PDF.

Solution : You can use the javascript if you want to get content of HTML while converting it into PDF :
<HTML>
<head>
<script type=”text/javascript”>
function submitForPDF()
{
document.getElementById(“mybutton”).style Read more…

Salesforce | Fatal error: Uncaught SoapFault exception: [sf:REQUEST_LIMIT_EXCEEDED] REQUEST_LIMIT_EXCEEDED: TotalRequests Limit exceeded

Author - Kiran Preet

Problem: “Fatal error: Uncaught SoapFault exception : [sf:REQUEST_LIMIT_EXCEEDED] REQUEST_LIMIT_EXCEEDED: TotalRequests Limit exceeded.”

In our case, this exception was raised while upserting records in Salesforce using PHPSFDC toolkit.

Solution: When our code exceeds API limit within Salesforce, it throws above exception. This is basically the total number of API calls that Read more…

Selenium | Unable to find Command button using Selenium Webdriver

Author - Webner

Problem: Unable to find the Command button using Selenium Webdriver.

Solution: You can use following script code if you want to find command button on a web page and then click it:
driver.findElement(By.xpath(“//button[text()='(Button name)’]”)).click();
Here is the script which we used in Webdriver Read more…

Moodle | Flash SCORM modules not showing content on shared hosting

Author - Webner

We faced a problem that Scorm content packages uploaded in Moodle were not displaying content correctly on shared hosting server. After entering the Quiz the page was redirecting back to the same page rather than displaying the further pages of the quiz. The reason was cgi.fix_pathinfo property having value Read more…

Selenium | Unable to find Command button using Selenium Webdriver

Author - Webner

Problem: Unable to find the Command button using Selenium Webdriver.

Solution: You can use following script code if you want to find command button on a web page and then click it:
driver.findElement(By.xpath(“//button[text()='(Button name)’]”)).click();
Here is the script which we used in Read more…

Chargify | Single php function for all Chargify API calls

Author - Ishpreet Kaur

Following single function can be used for all Chargify API calls whether API calls belong to test site (site for test transactions) or live site (live transactions):
<?php
function sendRequest($uri, $method, $data = ”)
{
$apiKey = ‘XOTUsyy7pJ6yLgmMa233AtJ’;
$subdomain = ‘abccompany-test’;
$username = $apiKey;
$password = ‘x’;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL Read more…

Salesforce | [message:protected] => INVALID_LOGIN: Invalid username, password, security token; or user locked out

Author - Kiran Preet

While upserting records using SFDC php API we were facing following exception :

[message:protected] => INVALID_LOGIN: Invalid username, password, security token; or user locked out.

This exception was showing up frequently when we were upserting records using PHP API. The username, password and security token which we were using were Read more…

Salesforce Integration | Upsert multiple records with single connection in PHP

Author - Kiran Preet

When we create connection with “SforceEnterpriseClient”, we can upsert one record and then we need to recreate connection for next upsert, which eventually can result in the exception:
“UnexpectedErrorFault: REQUEST_LIMIT_EXCEEDED: TotalRequests Limit exceeded.”
The solution is to use “SforcePartnerClient” instead of “SforceEnterpriseClient”.

An example with steps to upsert records in Read more…

PHP | How to call SOAP based web services from php

Author - Rita

We were working on codeigniter website project. We had wsdl web services available to access our backend functionality. We had configured a WSDL Client in our php code but it was not working.

Sample Code:
try
{
$testSoapClient = new SoapClient(TYPE_WSDL_PATH_HERE, array(‘trace’ => 1));
}
catch (Exception $e)
{
echo ‘Provider not Read more…

Google Maps | Display routes to different locations from common starting point

Author - Webner

Suppose in Google Maps you want to display routes to different locations from common starting
point.

For this we need accurate lat/long of the origin and destination addresses (only 1 origin and multiple destinations). We will use following statement to draw 1 route and run it in a loop Read more…