This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_title_via_url( $url ) | |
{ | |
// 抓取前1024个字节 | |
$context=array('http' => array ('header'=> 'Range: bytes=0-1024' )); | |
$xcontext = stream_context_create($context); | |
$content = strtolower( file_get_contents( $url , FALSE,$xcontext ) ); | |
$reg = '/<title>(.+?)<\/title>/is'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function rtime($time = false, $limit = 86400, $format = 'Y-m-d H:i') | |
{ | |
if(empty($time)||(!is_string($time)&& !is_numeric($time))) | |
$time = time(); | |
elseif (is_string($time)) | |
$time = strtotime($time); | |
$now = time(); | |
$relative = ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function is_email( $email ) | |
{ | |
return filter_var($email, FILTER_VALIDATE_EMAIL); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function mypost( $url , $data ) | |
{ | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); | |
curl_setopt($ch, CURLOPT_POST, true); | |
curl_setopt($ch, CURLOPT_TIMEOUT, 30); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (file_exists($_SERVER["SCRIPT_FILENAME"])) | |
{ | |
header('Access-Control-Allow-Origin: *'); | |
header('Access-Control-Allow-Headers: origin,x-requested-with,content-type'); | |
header('Access-Control-Allow-Methods: PUT,GET,POST,DELETE,OPTIONS'); | |
readfile($_SERVER["SCRIPT_FILENAME"]); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
foreach( glob( '*.html' ) as $k => $htmlfile ) | |
{ | |
echo "File $htmlfile ..."; | |
$reg = '/this\.feeds\s+=\s+(.+?)\}\s+,\s+1000/is'; | |
$content = file_get_contents( $htmlfile ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
foreach( glob( '*.html' ) as $k => $htmlfile ) | |
{ | |
echo "File: $htmlfile \r\n"; | |
$reg = '/this\.feeds\s+=\s+(.+?)\}\s+,\s+1000/is'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header('Access-Control-Allow-Origin: *'); | |
header('Access-Control-Allow-Headers: origin, x-requested-with, content-type'); | |
header('Access-Control-Allow-Methods: PUT, GET, POST, DELETE, OPTIONS'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_302_location( $url ) | |
{ | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url ); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from https://github.com/suxiaogang/WeiboPicBed | |
// under its license | |
function uploadToWeibo( url , callback ) | |
{ | |
var xhr = new XMLHttpRequest(); | |
xhr.onload = function() { | |
var reader = new FileReader(); | |
reader.onloadend = function( e ) | |
{ |
OlderNewer