PHP Frameworks Archives - Page 12 of 13

Sendgrid | How to send bulk emails in one batch using sendgrid in php

Author - Manju Kashyap

Recently we were working on a project in which the requirement was to send emails to 500 users at a time. Earlier, emails were being sent to 500 users in a loop 1 by 1 in which sendgrid-API was being called 500 times and this was consuming very huge Read more…

Mysql | Maximum execution time of 360 seconds exceeded at data import time

Author - Webner

In one of the project we had to import some .csv files into Mysql database. Files were of size 80mb and more. When we tried to upload the files through phpmyadmin it was resulting in timeout error – Maximum execution time of 360 seconds exceeded (see image below):

A better solution Read more…

Salesforce | How to access php code in salesforce apex class

Author - Webner

We can access the php code in salesforce using @future(callout=true/false). The function we make for accessing the php code in apex class is of static type and does not return any value.

Syntax:
@future(callout=true)
public static void function_Name()
{
//variable declaration
try
{
Http h Read more…

Joomla- Database Error: Unable to connect to the database

Author - Webner

While working with Joomla if you get an error – “Database Error: Unable to connect to the database:Could not connect to database”, check following properties in Joomla’s configuration.php file :

//given values are sample data only.

var $dbtype = ‘mysql’;

var $host = ‘localhost’;

var $user = ‘user_jo151’;

var $password = ‘YourPassword’;

var Read more…

Moodle | Call to undefined method mysqli_native_moodle_database :: insert_records()

Author - Manju Kashyap

We were using insert_records() function to insert multiple records in a Moodle database table but it was not working.

We checked for errors by adding following lines in config.php file of moodle:
@error_reporting(E_ALL | E_STRICT);

@ini_set(‘display_errors’, ‘1’);

$CFG->debug = (E_ALL | E_STRICT);

$CFG->debugdisplay = 1 Read more…

Heroku | How to delete prior database backups

Author - Namisha

Following are the steps to delete the Postgres database backup:

1. Login into heroku.

2. Click on the database>PG Backups. Here you can see all the PG backups list.

3. . For deleting the database, first of all you have to install the toolbelt.

You can download Toolbelt from Read more…

Cakephp | URL routing using prefix before domain name

Author - Webner

Routes in an application are configured in app/Config/routes.php. Defining your own routes allows you to define where your application will take the control to for a given URL.

Default routing is like this:

domain/controller/action
Ex. www.xyz.com/user/login
Prefix routing will Read more…

Zoho CRM | Reduce API call consumption

Author - Webner

This is a simple idea to reduce API calls consumption when you pull data from Zoho CRM into an integrated piece of code (like server side code in PHP or Java that connects to Zoho CRM to retrieve records). In one of the projects we were working on, we had Read more…

Run embedded batch files

Author - Kiran Preet

In one of the projects we had a batch file which runs another batch file within it in a loop. This was not working. It used to run once and then used to get stuck.

This is sample code of the outer batch file:

outer.bat:
cd/
cd Read more…

PHP | Clone arrays containing objects

Author - Webner

In PHP you need deep cloning to clone arrays containing objects.

Suppose we have $cold_items as an array of objects. To clone it appropriately so that while changing the values in one array does not impact the other one, use code like this:
$clonedArray = array();
foreach ($cold_items as Read more…

Call third party JSON webservice in cakephp 3.0

Author - Webner

To call third-party web service in CakePHP 3.0. You can use Http client available in CakePHP core lib (CakeNetworkHttpClient).

Include CakeNetworkHttpClient in your controller.
use CakeNetworkHttpClient;

Here is the method to call third-party web service. You can use this method on any controller. Data should be in Read more…

Cakephp | URL routing using prefix after domain name

Author - Webner

Routes in an application are configured in app/Config/routes.php. Defining your own routes allows you to define where your application will take the control to for a given URL.

Default routing is like this:

domain/controller/action
Ex. www.xyz.com/user/login

Prefix routing will add a Read more…

Moodle / PHP | The uploaded file exceeds the upload_max_filesize directive in php.ini

Author - Webner

How to increase the value of ‘upload_max_filesize’ variable to upload a file/plugin of larger size.

We were trying to install a new plugin with size of approx 3.5 mb in our moodle site. It was showing an error:”The uploaded file exceeds the upload_max_filesize directive in php.ini Read more…

Zoho Creator | post data to external URL and redirect there

Author - Webner

In zoho creator, we have postURL function to post the data to an external URL but it receives a response back instead of transferring control to the external webpage. For redirection Zoho provides openURL function in zoho creator with which we can send the data to another url by passing Read more…

Air Gapping | Mobile app connectivity with localhost services

Author - Webner

When we were trying to connect an android app with the php localhost services it was giving an error: cannot connect to the server please check your network connection.
Code independently was working but not when we were connecting Android app to localhost code. It was working on uploading the Read more…

Heroku | How to create/deploy your Php/CakePHP app (Ubuntu)

Author - Webner

1.  Sign up:

First, go to Heroku.com and click “sign up” to get your free Heroku account.

2.  Install the Heroku Toolbelt:

The Heroku Toolbelt contains the Heroku client, a command-line tool for creating and managing Heroku apps Read more…

XML parsing problem – HTML entity characters in XML

Author - Webner

Problem

We had written a PHP program to parse large XML files and split each file into smaller chunks. Program was working fine for all the XML files except few. It was not splitting some XML files. After looking for the issue we found that Read more…

Accessing AWS S3 bucket in PHP | Period / Dot in Bucket Name

Author - Webner

You may face a problem in your code if you are trying to access an AWS S3 bucket which contains period / dot in its name (like my.first.bucket). It gives a fatal error in PHP. This problem actually occurs with some AWS SDKs not all, so the solution is Read more…

PHP | Encoding Spanish Characters with json_encode

Author - Webner

You may face a problem with Spanish characters in PHP while trying to use json_encode. After json_encode it doesn’t give any result and no any error either. For solving this use utf8_encode instead of json_encode.
$result = utf8_encode ($value)

Webner Solutions is a Software Development company focused on developing CRM Read more…

Salesforce password expires and it needs to be changed in code everytime

Author - Webner

Problem:

We’re integrating Salesforce to a third-party e-commerce site using our custom cakephp app. In the app we’ve written code which uses Salesforce API to connect to Salesforce using Salesforce account username and password and then makes use of API calls to insert and Read more…