Skip to content

Instantly share code, notes, and snippets.

View codiiv's full-sized avatar

Jay codiiv

  • Canada
View GitHub Profile
@QROkes
QROkes / file.php
Created March 18, 2016 18:49
Get HTML source code with cUrl (file_get_contents as fallback)
$urlcontent = qr_loadUrl( 'http://myurl.com' );
function qr_loadUrl( $url ) {
if(is_callable( 'curl_init' )) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_URL, $url);
$data = curl_exec($ch);
curl_close($ch);
@bbg
bbg / example.html
Last active January 21, 2020 22:32
jQuery upload image take the base64 code
<!DOCTYPE html>
<html>
<head>
<metea charset="utf8">
<title></title>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.js"></script>
<script type="text/javascript">
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();