News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Rafael Dohms:
Installing Composer Packages
October 14, 2014 @ 12:04:58

Maybe you've heard about Composer and how it makes working with PHP libraries and packages easier. There's lots of articles (besides the project documentation) that can help you get started but Rafael Dohms has just shared an excellent overview of versioning and the features the tool makes available to fine tune your requirements to just the right level.

I have been putting together a new talk about Composer, and that means looking around the community, doing loads of research and trying to identify the items that need to be covered in a talk. Mostly I have been trying to identify things that people do on a regular basis that according to composer internals is either wrong or not ideal. One such thing that I have found is the proper selection of versions, and that also led me to find a new feature in composer that makes everyone's life so much easier. So let me break this down.

He starts with a look at the selection of the actual version you'll need and how Composer treats each type of version match (strict vs wildcards vs a mix of the two). He shows an example of adding one of these version strings to a "composer,json" file, both manually and via a command line call.

0 comments voice your opinion now!
composer version package require install tutorial

Link: http://blog.doh.ms/2014/10/13/installing-composer-packages/

Juozas Kaziukenas' Blog:
Scraping login requiring websites with cURL
February 24, 2009 @ 08:44:43

Several sites have areas that have content protected behind a login making them difficult to pull into a script. Juozas Kaziukenas has created an option to help you past this hurdle - a PHP class (that uses cURL) that can POST the login data to the script and pull back the session ID.

But how you are going to do all this work with cookies and session id? Luckily, PHP has cURL extension which simplifies connecting to remote addresses, using cookies, staying in one session, POSTing data, etc. It's really powerful library, which basically allows you to use all HTTP headers functionality. For secure pages crawling, I've created very simple Secure_Crawler class.

The class uses the built-in cURL functionality to send the POST information (in this case the username and password, but it can be easily changed for whatever the form requires) and provides a get() method to use for fetching other pages once you're connected.

0 comments voice your opinion now!
login require scrape curl secure crawler tutorial username password


Community News:
The PDO v2 Proposal
January 25, 2008 @ 08:58:00

Wez Furlong posted a request for comments to the php.internals and php.pdo mailing lists yesterday about a new ly proposed update to the current PDO functionality - PDO 2. He just wants to clear up a few things...

It became apparent over the past year or so that PDO has been a good and valuable addition to PHP. [...] We believe that having direct involvement from the data access providers would be most effective, which is why we set out to try and get them on board.

There were three steps they would need to make to push things to version two (documentation, define scope/direction and organize data provider integration methods) and the proposal that has caused a huge stir in the community - the idea of requiring a CLA contributors would need to sign.

Comments to this point from the community include:

0 comments voice your opinion now!
pdo data abstraction layer version cla require


DevShed:
Auto Loading Classes in PHP 5
December 04, 2007 @ 09:25:00

A new tutorial on DevShed today takes a look at a handy bit of functionality that's included with PHP5 - the automatic autoloading of classes.

As you might know, the "__autoload()" function, when used in a clever way, can eliminate almost completely the need to use the "require()/require_once()" and "include()/include_once()". [...] Now is the perfect time to move forward and start learning how to put the "__autoload()" magic function to work for you, and load your classes without having to include them manually into your PHP 5 object-oriented applications.

They show the more traditional approach with a code example (just using the require/include method) then show the difference in using a custom defined autoload function to tell the script where to find the libraries.

0 comments voice your opinion now!
php5 autload class tutorial require include php5 autload class tutorial require include


PHP Discovery Blog:
Dangers of Remote Execution
November 21, 2007 @ 13:48:00

On the PHP Discovery blog, there's a new post reminding PHP developers of some of the more dangerous ways that remote execution could effect your site and some of the common entry points it can have.

PHP has numerous ways to execute raw PHP code unless you the programmer stops it. Best way in preventing these methods is making sure you check the input of what your users are inputting, and making sure you escape all malicious actions that a hacker,cracker, kiddy scripter might want to do to your website.

He summarizes four of the things from the Pro PHP Security book from Apress (by Chris Snyder and Michael Southwell) that can leave holes in you application for would-be explots - preg_replace, shell_exec/exec, eval (which we all know is only one letter from "evil" anyway) and require/include.

0 comments voice your opinion now!
danger remote execution pregreplace include eval shellexec exec require danger remote execution pregreplace include eval shellexec exec require


PHP-Coding-Practices.com:
Try-Catch Syntax Weirdness
June 22, 2007 @ 13:28:00

In working with his code recently, Tim Koschuetzki noticed something odd with a block of try/catch code:

I just noticed today, that PHP's try catch blocks require curly braces. Anybody has an idea why it is like that? I have used curly braces by default up until now, so I just stumbled upon this weirdness today.

He includes two examples, one with a curly brace after the catch clause and the other without. This is different than several other control structures (like ifs) that don't require the curly brace when there's only the one line following it.

1 comment voice your opinion now!
try catch curlybrace require try catch curlybrace require


WebReference.com:
How to Interact with Web Forms (Part 2)
January 24, 2006 @ 07:03:09

With a continuation of their previous article, WebReference has posted part two of their "How to Interact with Web Forms" series - an excerpt from the PHP Phrasebook (Sams).

They build on the previous code, showing how to:

  • preselect items from a multiple select list,
  • process image submit buttons
  • checking the mandatory fields
  • checking the values of select lists
They wrap it all up with two handy concepts - how to write out your data to a form and send it off in email form to the location of your choosing and working with the files uploaded via a form.
0 comments voice your opinion now!
how to interact web forms select check require write file email how to interact web forms select check require write file email


Vidyut Luther's Blog:
Difference between "require()" and "include()" in PHP
January 05, 2006 @ 06:56:33

On his blog, phpcult.com, Vidyut Luther talks about the difference between require and include in PHP.

This should be well known, and people should be aware as to why they are using either or. But, I've noticed lately that a lot of people new to PHP or programming are not aware of the difference. Depending on what you need you, need to decide what the differences are.

It's a short post, but for someone just getting into PHP, it's some handy information to have. He looks at both functions and gives what they're good for. He does throw in a few caveats, though - including an issue with parse errors in included files pre-PHP 4.3.5...

0 comments voice your opinion now!
different include require fatal error warning different include require fatal error warning



Community Events





Don't see your event here?
Let us know!


podcast version language artisanfiles opinion laravel interview framework library release voicesoftheelephpant security community conference tool composer symfony introduction series list

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework