Skip to content

Instantly share code, notes, and snippets.

View ertankayalar's full-sized avatar
🏠
Working from home

Ertan Kayalar ertankayalar

🏠
Working from home
View GitHub Profile
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
if ($handle = opendir('/media/book')) {
echo "Directory handle: $handle\n";
echo "Files:\n";
/* This is the correct way to loop over the directory. */
@ertankayalar
ertankayalar / extract-image-from-html.php
Created June 22, 2013 13:54
extract image from html
<?php
$contenttograbimagefrom = $youroriginalhtmlwithimage;
$firstImage = "";
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $contenttograbimagefrom, $ContentImages);
$firstImage = $ContentImages[1] [0]; // To grab the first image
echo $firstImage;
@ertankayalar
ertankayalar / csv-from-db.php
Created June 22, 2013 13:53
create .csv from DB
<?php
import_request_variables('gpc');
$host = ''; // <-- db address
$user = ''; // <-- db user name
$pass = ''; // <-- password
$db = 'rsvp_list'; // db's name
$table = 'guest_list'; // table you want to export
$file = '6am_event_guest_list'; // csv name.
<?php
$the_url = isset($_REQUEST['url']) ? htmlspecialchars($_REQUEST['url']) : '';
?>
<form method="post">
Please enter full URL of the page to parse (including http://):<br />
<input type="text" name="url" size="65" value="<?php echo $the_url; ?>"/><br />
or enter text directly into textarea below:<br />
<textarea name="text" cols="50" rows="15"></textarea>
@ertankayalar
ertankayalar / blank.html
Created April 11, 2013 13:34
HTML: Blank Template Page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>POST Page - WP Bootstrap Temple</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- Le styles -->