Skip to content

Instantly share code, notes, and snippets.

@phpfiddle
phpfiddle / fiddle_011432.php
Created January 3, 2020 19:48
[ Posted by Antoine.sirkis ] rss random item
<?php
if(rand(0,100)<30){ // 30% du temps le rss est stoppé, pour ne pas dépasser la limite quotidienne de 25
//exit();
}
$heure = intval(date("G"));
if(in_array($heure,[3,4,5,6,7,8,10,13,15,19])){ // la liste des horaires où le rss fournit des tweets à poster
//exit();
}
header('Content-Type: application/xml; charset=utf-8');
date_default_timezone_set('Europe/Paris');
@phpfiddle
phpfiddle / fiddle_090751.php
Created December 18, 2019 11:46
[ Posted by Hiren ] Embed link for youtube and vimeo
<?php
$embed = "";
$thumb = "";
$url = $resource->video;
if (strpos($url, 'youtube') > 0)
{
$embed = 'https://www.youtube.com/embed/';
// Now get the 'v=' value & stick on the end
preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $url, $matches);
$v = $matches[1];
@phpfiddle
phpfiddle / fiddle_056085.php
Created December 18, 2019 09:34
[ Posted by Guest ] flowplayer
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=iso-8859-2">
<meta charset="utf-8">
<title>
Norwid
</title>
<link rel="stylesheet" href="//releases.flowplayer.org/7.2.4/skin/skin.css">
<script src="//code.jquery.com/jquery-1.12.4.min.js"></script>
@phpfiddle
phpfiddle / fiddle_061115.php
Created November 24, 2019 17:43
[ Posted by James ] Ian test 2
<?php
function productfeatureorder($order)
{
// mysqli_real_connect
// Create connection
$url = $_SERVER['HTTP_HOST'];
if ($url == 'belchim.avalonbloom.com') {
//$conn (<<objectname)= mysqli_connect('url:string', 'User:string', 'database:string', 'port(not required if default):string', Socket(not required if default):string), ;
$conn = mysqli_connect('localhost', 'belchim', 'belchim', 'belchim');
@phpfiddle
phpfiddle / fiddle_076783.php
Created November 24, 2019 17:31
[ Posted by James ] How to for IAN
<?php
function productfeatureorder($order)
{
// mysqli_real_connect
// Create connection
$url = $_SERVER['HTTP_HOST'];
if ($url == 'belchim.avalonbloom.com') {
//$conn (<<objectname)= mysqli_connect('url:string', 'User:string', 'database:string', 'port(not required if default):string', Socket(not required if default):string), ;
$conn = mysqli_connect('localhost', 'belchim', 'belchim', 'belchim');
@phpfiddle
phpfiddle / fiddle_082629.php
Created November 12, 2019 09:39
[ Posted by Alexander ] Hust test code
<?php
echo 'test';
?>
@phpfiddle
phpfiddle / fiddle_075621.php
Created October 25, 2019 14:38
[ Posted by Myeishvar ] This is an easyway to send unicode sms by www.Lifetimesms.com
<?php
$url = "http://admin.lifetimesms.com/plain";
$parameters = array("api_token" => "Your API token",
"api_secret" => "Your API secret",
"to" => "92xxxxxxxxxx",
"from" => "Brand",
"type" => "unicode",
"message" => "لائف ٹائم ایس ایم ایس"
@phpfiddle
phpfiddle / fiddle_057161.php
Created September 21, 2019 16:47
[ Posted by Pravallika ] WhatIsToday
What day is today?:
<form method="post" action="">
<input type="text" name="value">
<input type="submit">
</form>
<?php
if (isset($_POST['value'])) {
@phpfiddle
phpfiddle / fiddle_053877.php
Created September 18, 2019 15:24
[ Posted by Expangea ] PHP preg_match_all xml tags
<?php
$text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. <code>Donec sed erat</code> vel diam ultricies commodo.
Nunc venenatis tellus eu quam suscipit quis fermentum <code>dolor vehicula.</code> fin";
$regex='';
$regex = '#<\s*?code\b[^>]*>(.*?)</code\b[^>]*>#s';
$code = preg_match_all($regex, $text, $matches);
echo $text."<hr>";
echo var_export($matches,true);
?>
@phpfiddle
phpfiddle / fiddle_087311.php
Created September 17, 2019 14:29
[ Posted by Muhammad Ahmad ] application_test
<?php
$redirect_uri = 'http://localhost/myapp/';
$client_id = 'f9d70f3f-08c1-4df3-9f9a-f3ce24b572a3';
$client_secret = 'XzB@RgTO3CYUO80Si-8gdlD@g[4]IW[c';
$auth_code = $_GET['code'];
$scope="https://graph.microsoft.com/Contacts.ReadWrite";
$fields=array(
'code'=> urlencode($auth_code),
'client_id'=> urlencode($client_id),
'client_secret'=> urlencode($client_secret),