 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
PHPMaster.com: Understanding OAuth - Tweeting from Scratch, Part 2
by Chris Cornutt October 25, 2011 @ 10:09:48
On PHPMaster.com today they're posted the second part of their OAuth series showing you how to use the authentication mechanism to connect to Twitter's API. (Part one is here.
Welcome back to Understanding OAuth - Tweeting from Scratch. This is Part 2 of the two-part series and picks up right where we left off in Part 1 with your returned Access Credentials. Since obtaining the credentials is the grueling part of the process, there's not much more left to do except posting a tweet on the user's behalf. Hopefully you'll find the final steps to be a lot easier to follow and more fun to implement.
They show you how to store the credentials from Part 1 into your session for safe keeping and include a simple form you will use to send a tweet to Twitter. They choose to manually build the HTTP POST request, including the credential headers along with the payload (oauth_consumer_key, oauth_signature, oauth_token, etc).
voice your opinion now!
oauth tutorial tweet series connection authentication api
Shay Ben Moshe's Blog: PDO Persistent Connection Analysis
by Chris Cornutt June 28, 2011 @ 08:11:15
Shay Ben Moshe has a new post to his blog today looking at some of the benefits that using the persistent connections offered in PDO can have on your application.
PDO is an abstraction layer for database connections in PHP, and it became increasingly popular in the past few years. PDO gives us the option to use a persistent connection. If we don't use this option, a new connection is created for each request. If we do use this option, the connection is not closed at the end of the script, and it is then re-used by other script requests.
He shares the setup for his testing (hardware and MySQL configuration) and some of the results from his tests using the Apache ab tool for making web requests against an application. You'll need to download the archived file to see the results, though. It also includes the files he used to test with, comparing regular connections to the persistent ones.
voice your opinion now!
pdo persistent connection benchmark apache ab request
Eran Galperin's Blog: Breaking Down The PayPal API
by Chris Cornutt April 25, 2011 @ 09:50:54
In a recent post Eran Galperin takes a look at the PayPal API and breaks it down into smaller, easy to digest chunks to show you how to you can implement it in your application. Be warned, though - he mentions that it's the "among the worst API he's ever had to deal with" for several reasons.
PayPal is the most popular platform for receiving online payments. The relative ease of opening a PayPal account and receiving payments compared to opening a merchant account for a traditional payment gateway is the number one reason, and another is the comprehensive API they provide for their payment services. [...] There doesn't seem to be any better alternatives currently, so hopefully this guide will help ease the pain for some of you out there taking your lumps working the API into your applications.
Eran starts with a look at some of the different payment options, express, direct, recurring and mass, and what they're good for. From there, it's off to the code with his tool of choice being curl to make it simpler to make requests with headers, content and fetch the response message. He's put together a little custom function to make it easier to reuse. As an example, he shows how to make an Express Checkout request by grabbing a token and redirecting to the PayPal site for handling.
voice your opinion now!
paypal api connection tutorial payment soap request curl
Brian Swan's Blog: SQL Server Driver for PHP Connection Options CharacterSet
by Chris Cornutt February 28, 2011 @ 12:15:33
Brian Swan has posted another in his series looking at connection options for the SQL Server driver for PHP. In his latest he looks at the "CharacterSet" setting, an easy way to define which encoding the remote database is using.
One thing that helped me understand the CharacterSet option was to realize that its name is a bit misleading (although it seems to be inline with other uses of CharacterSet or charset). It is used to specify the encoding of data that is being sent to the server, not the character set. With that in mind, the possible values for the option begin to make sense: SQLSRV_ENC_CHAR, SQLSRV_ENC_BINARY, and UTF-8.
He looks at each of these three options in more detail - SQLSRV_ENC_CHAR being the default, SQLSRV_ENC_BINARY when binary data is needed and UTF-8 when, obviously, you need UTF-8 data transfer between the client and server.
voice your opinion now!
sqlserver connection option characterset encoding
Chris Jones' Blog: PHP OCI8 and Oracle 11g DRCP Connection Pooling in Pictures
by Chris Cornutt February 22, 2011 @ 10:44:46
Chris Jones has posted some "pictures" of the performance that an Oracle database sees when it uses the connection pooling versus the normal connect/allocate sort of connection with the Oracle OCI8 driver for PHP. As you can see, the differences in memory consumption are huge.
Here is a screen shot from a PHP OCI8 connection pooling demo that I like to run. It graphically shows how little database host memory is needed when using DRCP connection pooling with Oracle Database 11g. Migrating to DRCP can be as simple as starting the pool and changing the connection string in your PHP application.
He also describes the differences between the pooled and non-pooled connections (to the developer it's as easy as putting ":pooled" in the connect string) in his graphs, and notes that using the pooling doesn't just have to be for large site - smaller sites can benefit too.
voice your opinion now!
oci8 oracle connection pooling performance graph result
Brian Swan's Blog: SQL Server Driver for PHP Connection Options ReturnDatesAsStrings
by Chris Cornutt February 09, 2011 @ 08:45:28
Brian Swan has a new post to his blog today looking at one of the connection options for the SQL Server driver in PHP - the "ReturnDatesAsStrings" setting that can make handling date and time information simpler for PHP.
This is short post to address a frustration I've seen mentioned on Twitter and in forums a lot: By default, the SQL Server Driver for PHP returns datetime columns as PHP DateTime objects, not strings. This can be especially frustrating if you are not aware of the ReturnDatesAsStrings connection option. By simply setting this option to 1 (or true) when you connect to the server, datetime columns will be returned as strings.
He includes some sample code showing how to use the setting (as a part of the settings array passed in to sqlsrv_connect) and the resulting array key from the fetched results on his sample table. This just gives you one more option for handling dates in your SQL Server-based application, especially if you don't need the full DateTIme object's functionality.
voice your opinion now!
sqlserver driver connection option return date string datetime
Brian Swan's Blog: SQL Server Driver for PHP Connection Options Connection Pooling
by Chris Cornutt November 18, 2010 @ 10:17:17
Brian Swan has another post in his series looking at using the SQL Server driver in PHP applications. This part of the series looks specifically at using the connection pooling option to help improve overall performance of the application.
One topic that came up yesterday [during Jump In! Camp] was connection pooling and how much difference using pooled connections makes in app performance, so that's what I'll look at in this post.
He starts by defining (from Wikipedia) what connection pooling is and then puts it in the context of SQL Server by talking about the handling of connections returned to the pool. He shows how to enable and disable the feature via a parameter in the connection options and shows how to configure the number of seconds a connection stays active in the pool.
voice your opinion now!
sqlserver connection pooling database microsoft tutorial
Gonzalo Ayuso's Blog: Database connection pooling with PHP and gearman
by Chris Cornutt November 01, 2010 @ 09:07:51
Gonzalo Ayuso has a new post to his blog today looking at using the Gearman tool to pool database connections for his application and make them available for easy reuse.
Handling Database connections with PHP is pretty straightforward. Just open database connection, perform the actions we need, and close it. There's a little problem. We cannot create a pool of database connections. We need to create the connection in every request. Create and destroy, again and again. [...] In this post I'm going to try to explain a personal experiment to create a connection pooling using gearman.
He includes a basic database connection example with PDO, logging into a single database and fetching all of the results. To integrate this into the gearman functionality, he creates a configuration class to hold connection details and the worker code (along with some libraries to help manage the connections) that gets the results, serializes them and returns them back to the calling script.
voice your opinion now!
database connection pool gearman pdo
Andrey Hristov's Blog: Replacing mysqli's Connection, Result and Statement classes
by Chris Cornutt July 09, 2010 @ 10:31:03
On his blog today Andrey Hristov has a quick post that talks about two methods to extend the functionality that the mysqli extension offers in PHP with your own custom code.
Have you ever though about extending mysqli's classes. It's pretty simple to subclass the connection class mysqli. However, subclassing mysqli_result and mysqli_stmt is not so obvious, actually I though that it's even not possible. However, never say never! After discussing mysqli's OO interface for an hour yesterday [...] I found out how one can plug his own classes.
Two code examples are provided - one for extending the mysqli_result and the other extending the mysql_stmt class. You can find more about these and other classes the mysqli extension has to offer in this section of the PHP manual.
voice your opinion now!
replace mysqli connection result statement class extend
|
Community Events
Don't see your event here? Let us know!
|