Archive for the ‘PHP’ Category

Liberty Reserve – XML API with SSL error fix

This item was filled under [ Online Currency, PHP ]

Back to few days ago, Liberty Reserve (LR) XML API is not working in my PHP script, when I try to retrieve the transaction history. If you do not know what is LR, it is one of the largest E-currency payment gateway.
I have been using CURL to retrieve the information for since few months ago. [...]

Continue reading...

Tagged with: [ , , , , , ]

Import large database in remote server

This item was filled under [ MySQL, PHP ]

If you owned slow internet connection, it would be headache if you have large database to be imported in a remote server. Either you import the database through MySQL GUI or phpMyAdmin, the execution time is mostly will exceed the maximum execution time allowed, resulting in an script timeout problem. It would be same if [...]

Continue reading...

Tagged with: [ , , , ]

Passing Object from Flash AS3 to PHP

This item was filled under [ ActionScript 3.0, PHP ]

In previous post, we learnt how to pass an JSON encoded object from PHP to AS3. How about passing an Object from AS3 to PHP?
This example will show you how to do it. Take a look at the Flash ActionScript.

import flash.net.URLRequest;
import flash.net.URLLoader;
import com.adobe.serialization.json.JSON;

var people:Array = new Array();
var person:Object = new Object();
person.firstname = "Kobe";
person.lastname = "Bryant";
people.push(person);

var [...]

Continue reading...

Tagged with: [ , , , , ]

Checking Account Status in LDAP

This item was filled under [ PHP, active directory ]

How to check if an account is disabled in LDAP?
Previously I googled and someone suggest that, the ‘useraccountcontrol’ with 512 would be disabled, 514 would be enabled.
But this is too unreliable. If there are other options for that particular account are set, for example “password never expired” and “user cannot change password”, the status would [...]

Continue reading...

Importance of initialization of variable inside Function

This item was filled under [ PHP ]

Just a reminder for myself and those who might found this useful:
It is important to initialize the variable inside the function. As for me, I have encountered an error when calling a function for the 2nd time, before the 1st execution is finished. For example:
function call(abc) {
//some delay up to few seconds
[...]

Continue reading...

PHP variable performance

This item was filled under [ PHP ]

I ran a simple test which print out the variable $var = “” (empty string) with a loop of 100,000 times for 10 times, and the average in seconds. The table below is what I get using Core 2 Duo E6320 processor.

1
2
3
4
5
6
7
8
9
10
Avg

“$var”
0.037
0.067
0.099
0.138
0.170
0.201
0.234
0.272
0.302
0.334
0.0334

$var
0.015
0.029
0.044
0.062
0.078
0.093
0.107
0.125
0.140
0.154
0.0154

“{$var}”
0.030
0.060
0.090
0.123
0.153
0.182
0.213
0.244
0.274
0.304
0.0304

The first case is echo “$var”, the 2nd is the traditional echo $var, and [...]

Continue reading...

Tagged with: [ , , , , , ]