Welcome To Snipplr
Everyone's Recent Snippets Tagged php
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
This example of code shows how to do a simple POST request in PHP to another web server by using a socket connection.
0
1846
posted 11 years ago by apphp-snippets
**Example of use:**
<a href="http://www.php.net/manual/en/index.php"><img src="<?php echo get_favicon('http://www.php.net/manual/en/index.php') ?>" alt="Favicon" title="See PHP documentation" width="16" height="16" /></a>
0
1524
posted 11 years ago by phpdev
Helps to find out browser version and type your website visitor is using.
0
914
posted 11 years ago by apphp-snippets
This code allows to get the IP address from which the user is viewing the current page.
0
1123
posted 11 years ago by apphp-snippets
If you are using the [TimThumb](http://code.google.com/p/timthumb/ "TimThumb on Google Code") script with a URL the contains tildes (~) and images are breaking, here is the fix...
I did not create this snippet but found it extremely useful so I th...
0
1008
posted 11 years ago by tacudtap
**Example of use:**
$bIsConnected = check_internet_connection();
$sText = ($bIsConnected) ? 'You are connected to the Internet.' : 'You are not connected to the Internet.';
echo $sText;
0
1889
posted 11 years ago by phpdev
To set cookie use "cookie('name of your cookie','cookie data','expire date ')" it will set your cookie in the user browser .
To get the saved cookie use "cookie('name of your cookie')" it will give you the value of the cookie which you saved in the...
0
824
posted 11 years ago by kameshsoft
Izvorni kod za web aplikaciju u kojoj smo implementirali validaciju jednokratne zaporke koju generira uređaj YubiKey.
0
522
posted 11 years ago by DSTG_Kwan
In my WP networks, I use a custom 404 page and plugin to answer calls asking for user information from a custom api. The API requires a URL format like this:
domain.com/username/
However, users don't ever type a trailing slash, nor should they, so...
0
1242
posted 11 years ago by lucasoptura
This is a static session wrapper that handles single variables and arrays. It allows setting, resetting, and deleting session variables (without destroying the session). It regenerates the session id every time a session is started to prevent sessi...
0
918
posted 11 years ago by halk
PHP
HTML Helper Function Create Any Element With Any Number Of Attributes (self-closing and container tags)
/**
* THIS FUNCTION WILL RENDER A CONTAINER OR SELF-CLOSING HTML ELEMENT.
* IT AUTO DETECTS WHAT TYPE YOU WANT
* BASED ON RATHER OR NOT YOU SET A _data KEY IN THE ARRAY OF
* ATTRIBUTES PASSED TO THE FUNCTION
*
* USING AN ASSOCIATIVE ARRA...
0
972
posted 12 years ago by halk
pass a variable from web site (in php, in this case) to iOS app.
0
1126
posted 12 years ago by code4mac
https://gist.github.com/4098493
(examples of use below the class code)
This class allows you to load a file of snippets that are really mini-templates copy them from your repository fill the token slots in them the with your data and render them as...
0
1002
posted 12 years ago by halk
Does not require http in the text to link. It must start with www however. Optionaly make the links popup in a new window.
0
1287
posted 12 years ago by halk
# Método setter y getter
Hace mucho tiempo usaba esta manera para tener un solo método que sea getter y setter al mismo tiempo.
0
493
posted 12 years ago by prigazzi
This function dosen't use curl, or any other libraries. Just include it in your function library and use it like this:
$Post_result = _post('http://www.yourdomain.com/your_path/post_api.php',"method=fetchJson¶ms=select * from user");
0
999
posted 12 years ago by halk
A function to upload an image to the media library and set it as featured image of a post. It requires 2 params. The name of the upload field and of course the post ID.
This function is part of the WPelements library class available on Github. Fee...
0
1190
posted 12 years ago by krike
A usefull function to minify code or string. This is part of the WPelements library class available on Github.
Feedback / suggestions / improvements are welcome.
0
725
posted 12 years ago by krike
Want to be able to display the source code of any webpage, with line numbering? Here is a simple code snippet to do it. Just modify the url on line 2 at your convenience. Or even better, make a pretty function according to your needs.
2
936
posted 12 years ago by o0110o