Skip to content

Instantly share code, notes, and snippets.

<?php
//http://stackoverflow.com/questions/3080146/post-data-to-a-url-in-php
$url = 'http://www.someurl.com';
$myvars = 'myvar1=' . $myvar1 . '&myvar2=' . $myvar2;
$ch = curl_init( $url );
curl_setopt( $ch, CURLOPT_POST, 1);
curl_setopt( $ch, CURLOPT_POSTFIELDS, $myvars);
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>The HTML5 Herald</title>
<meta name="description" content="The HTML5 Herald">
<meta name="author" content="SitePoint">
@calebcgates
calebcgates / Web_Scraper_Python.py
Created July 26, 2016 16:37
Web Scraper Python LXML & XPATH
################################################################################################################
################################################################################################################
# purpose of this program is to scrap data from a page using lxml and Xpath
# original tutorial found at http://docs.python-guide.org/en/latest/scenarios/scrape/
# here we go
### was told to install lxml using
### pip install lxml ###CONTINUE READING BEFORE INSTALLING
### pip install requests ###CONTINUE READING BEFORE INSTALLING
@calebcgates
calebcgates / vim_commands.txt
Last active November 1, 2016 21:28
Vim Commands
:set number
:set autoindent
:set tabstop=4
:imap jj <Esc>
v /word Enter //begin visual select and select until first occurance of word
0 // beginning of line
gm // go to middle
gg // go to bottom
G // go to top
@calebcgates
calebcgates / test_input.php
Created July 26, 2016 14:46
PHP test_input
<?php
// define variables and set to empty values
$name = $email = $gender = $comment = $website = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = test_input($_POST["name"]);
$email = test_input($_POST["email"]);
$website = test_input($_POST["website"]);
$comment = test_input($_POST["comment"]);
$gender = test_input($_POST["gender"]);