Using XHR and PHP for files upload
The website ProDevTips propose a tutorial about multiple file upload with PHP and XHR.
First of all, we now use stream_copy_to_stream to upload the files, hence such things as max file upload size and so on will not be respected. Luckily Valums’ solution will do th [...]
Using the Tidy PHP extension
When you want to perform checks on the tags xHTML programming, there are various tools to generate the transaction or directly through the web.
The site shows PHPsnippets as a script, a way to complete the transaction from the Tidy extension and PHP
The operation is very easy to implement because you just need to specify the page to check to get the desired result and see if your page contains format errors
Read the article about Tidy
Using closures in PHP 5.3
Since the release of PHP 5.3, the closures are often used. There are few descriptions around the web showing you all the power offered by the new closures.
Vance Lucas published an article on this subject with five examples to put theory into practice, which are:
- Templating
- Extending dynamic code
- Completion Time
- Caching
- Convenience (as in their role in specific functions for callbacks)
These five examples show that it is possible to use the closures very easily with very few lines of code.
PHP – Remote post on WordPress using cUrl
Here's a code snippet function for remote posting on WordPress blogs I've made for my usage. It use XML-RPC and cUrl to publish on your blog.
Hope it'll help you.
-
< ?php
-
-
/**
-
* Remote post on WordPress function
-
*
-
* @date 2010-10-22
-
* @author David Ansermot
-
* @url http://v2.ansermot.ch
-
*
-
* @param string $url: Your blog's url
-
* @param string $login: Your blog's login
-
* @param string $pass: Your blog's password
-
* @param string $postTitle: The post's title
-
* @param string $postCats: A comma separated list of categories's ids
-
* @param string $postContent: The post's content
-
* @return bool
-
*/
-
function curlRemotePostToWordPress($url, $login, $pass, $postTitle, $postCats, $postContent) {
-
-
// Remote post url
-
-
// Categories for the post
-
-
// Post xml
-
$xml = ''.$postTitle.'
-
-
< ![CDATA[ '.$postContent.' ] ]>';
-
-
// Build request
-
-
// Send the request
-
try {
-
-
-
// cUrl configuration
-
-
// Execution
-
-
return true;
-
-
} catch (Exception $e) {
-
-
return false;
-
-
}
-
}
-
-
?>
