Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 PHP


  PHP to get access token for Facebook app

Since Facebook is now using OAuth 2.0 to authenticate apps to access user information. the SDK of Facebook has provided developers some useful functions to get authentication done. For example, in PHP SDK, there are getAccessToken(), getLoginUrl() etc. But unfortunately, for me I cannot use getAccessToken() method to get the user access token, it only returns me the app access token. Finally I gave up this approach to get access token for the time being. I may later retry this approach if I have time.Today I show you another way to get the access token, which is explained on Facebook's develop...

29,287 4       FACEOOK PHP ACCESS TOKEN SIGNED REQUEST


  Resolving error "SSL certificate problem: self signed certificate in certificate chain"

In a PHP application, cURL is frequently used to make connection to remote server to request some resource. It can be used to transfer data with different protocols such as HTTP, HTTPS, FTP etc.While using cURL in PHP, someone may get an error with message similar to "SSL certificate problem: self signed certificate in certificate chain".This may happen when cURL tries to make a SSL connection server and the server returns a server certificate which is self-signed and it's not trusted by the client(in the client CA store). In this case, you may need to follow below steps to resolve this issue....

28,973 1       PHP SSL CURL TWILIO


  Using PHP sessions across subdomains

By default, PHP uses the 'PHPSESSID' cookie to propagate session data across multiple pages, and by default it uses the current top-level domain and subdomain in the cookie declaration.Example: www.domain.comThe downside to this is that the session data can't travel with you to other subdomains. So if you started a session on www.domain.com, the session data would become unavailable on forums.domain.com. The solution is to change the domain PHP uses when it sets the 'PHPSESSID' cookie.Assuming you have an init file that you include at the top of every PHP page, you can use the ini_set() functi...

26,595 0       PHP SESSION AVAILABILITY SUBDOMAIN


  Useful functions to provide secure PHP application

Security is a very important aspect of programming. There are many functions or modules in any kind of real programming language providing security functionalities  In modern websites, we may often get inputs form users all around the world.There is a famous saying which says that never trust user input. So in web programming languages, we will often see functions which will guarantee the security of the data input from users. Today we will cover some of these functions in the most famous open source language  - PHP.In PHP, there are few useful functions which is very handy for preve...

26,028 0       PHP SECURITY SQL INJECTION XSS AJAX


  Sending message to Slack Incoming Webhook using PHP

Slack is a popular work collaboration tool and it provides many features which help teams collaborate. It has one function which allows sending messages to channels from external source such as your own web service -- Incoming Webhook. This is extremely useful when want to monitor something and get notified when some event occurs and it doesn't require complicated setup.To send messages using Incoming Webhook, a service URL has to be generated on Slack and then the message can be posted to this URL and it will be posted on your team channel. After clicking "Add Configuration", the process...

25,817 0       PHP CURL SLACK INCOMING WEBHOOK


  Automatically post to Facebook from PHP script

Facebook is currently on of the most important publishing and traffic generating sources for many websites. Manually Cross publishing content on your own site and Facebook seems like a lot of extra work.This post guides you through the creation of a Facebook application that can automatically post messages and other types of content on your Facebook wall.Getting startedBuilding a php script that automatically posts status updates on your wall requires the following steps:Download Facebook APIRegister a Facebook appGive the app rights to post on your wallBuild the post to Facebook scriptGet the...

25,026 2       PHP FACEBOOK API OAUTH AUTO POST


  Set PHP session timeout

There are many different discussions about PHP sessions. We may often face some weird issues while handling PHP sessions. Sometimes session is expired earlier than expected. Or sometimes the session is not expired. This introduces many confusions.Today we discuss how to set PHP session timeout correctly today. In php.ini, there are three key parameters which will affect the session timeout. session.gc_maxlifetime, session.gc_probability and session.gc_divisor. session.gc_maxlifetime defined the lifetime of a session in seconds which indicates when the session will be garbage collected. Then se...

21,299 3       PHP SESSION TIMEOUT


  PHP Sucks! But I Like It!

I read a rather interesting post yesterday called PHP: a fractal of bad design. It's been getting a lot of traffic among the PHP community lately because it's rather inflammatory. But to be honest, it does make a lot of really good points. It also makes a lot of mistakes and misses a bigger picture.A Few MistakesThe post makes quite a few mistakes and odd apples to oranges comparisons. Let me point out the major ones that I saw.No Debugger - PHP has xdebug which works quite well as an interactive debugger.Lack Of Threading - This is true, but he lists it as a difficulty, and I list it as ...

19,172 0       PHP LIKE BAD DESIGN