Authorsonal.raut

Display Facebook likes / Shares PHP function

D

The Code Below is a super simple function that retrieves a JSON feed of comments, likes and shares for any URL you provide. function facebook_shares($url){ $fql = “SELECT url, normalized_url, share_count, like_count, comment_count, “; $fql .= “total_count, commentsbox_count, comments_fbid, click_count FROM “; $fql .= “link_stat WHERE url = ‘”.$url...

Show Google Plus’s – PHP function

S

It’s worth pointing out you must have CURL enabled on your web server, I believe it’s enabled by default on PHP5 setups. Also the Key below Isn’t a unique API key you must leave the key as is to ensure the code works properly. function gplus_shares($url){ // G+ DATA $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, “;); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch...

Create Secure Scripts with PHP Programming

C

Believe it or not, there is no such thing as a secure program or application, not even with all the firewalls and encryption added in it. Vulnerabilities are already present even when the program or application is still being coded by the programmer, and there is no way for a programmer to eliminate these vulnerabilities. What he or she can do is to minimize the occurrences of these...

WEBSITE DESIGN MADE EASY USING PHP CODE

W

The PHP scripting language has become popular and it was designed specifically for producing web pages. Many web design company Sydney use PHP as the implementation language because it allows them to build a dynamically-generated web page quickly and easily. It gives you the option to create a PHP template that you can use to create and design your website faster. Here are steps on how to design...

Detect User Language With PHP

D

This function uses php server variables to detect the “possible” language of the browser of the connected user. This let you show information with the correct language. Since the HTTP_ACCEPT_LANGUAGE variable contains many information there is some dirty job to do with regular expression to clean the variable and determine the most important value from the ones contained. The HTTP_ACCEPT_LANGUAGE...

Web Services and PHP – SOAP vs XML-RPC vs REST

W

What is web services? In a typical web surfing scenario, a visitor visits a website and use the functionality provided by that particular website.HTTP request is send to server from web browsers and server responses are translated by browser to display the desired result of the visitor. But, this scenario has been changed in the recent days. You don’t need to visit the particular website to use...

How to run cronjobs per second in php?

H

To run cronjob per second you have to execute crontab/cronjob per minute and then have to run task in cron file per second using PHP function time_sleep_until(). <?php $start = microtime(true); for($ii=0;$ii<60;$ii++) { //………………………. /// here is the tasks which need to run per second… //………………………. time_sleep_until($start + $ii + 1); } // end for if (!function_exists(‘time_sleep_until’)) {...

PHP Debug Log – Trace Errors

P

“Debug Log” is good sort of tool for monitoring programs. Trouble shooting is quite simple with Log Files. Log file can be used with analysis tools, it’s possible to get a good idea of where errors are coming from, how often errors return. Here you can see a simple PHP script to trace PHP programs… debugLog.php …………………. function debugLog($log, $text) { $log_dir = dirname($log); if( ...

Web Services with SOAP in PHP

W

The SOAP and XML-RPC extensions are packaged with the PHP 5 installation. The SOAP extension and the XML-RPC extension are not enabled by default in a PHP installation. To enable the SOAP and XML-RPC extensions add the following extension directives in the php.ini configuration file. extension=php_xmlrpc.dll extension=php_soap.dll Restart the Apache server to activate the SOAP and XML-RPC...

Salesforce form integration (web-to-lead) with PHP and cURL

S

In the example below I am only showing the basic process. I am leaving out the validation code for the fields and any submission code to MySQL database. One security advantage of this process is hiding your organisation id within a variable in the submission page rather than on the live page with the form. // SF Org Id. $oid = "0113543434646"; I first check if cURL is enabled before processing...

Category