本文整理汇总了PHP中get_string_between函数的典型用法代码示例。如果您正苦于以下问题:PHP get_string_between函数的具体用法?PHP get_string_between怎么用?PHP get_string_between使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_string_between函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set_skin
function set_skin($username, $password, $skin)
{
$login_url = "https://minecraft.net/login";
$skin_url = "https://minecraft.net/profile/skin";
//first, login to Minecraft.net
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $login_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, "/dev/null");
curl_setopt($ch, CURLOPT_HEADER, true);
$fields = array("username" => urlencode($username), "password" => urlencode($password));
post($ch, $fields);
curl_exec($ch);
//Then, load the profile page to retrieve authenticityToken
curl_setopt($ch, CURLOPT_URL, $skin_url);
$result = curl_exec($ch);
$token = get_string_between($result, 'name="authenticityToken" value="', '">');
//finally, post the skin update
$headers = array("Content-Type:multipart/form-data");
// cURL headers for file uploading
$fields = array("model" => "steve", "skin" => "@{$skin}", "authenticityToken" => $token);
$options = array(CURLOPT_URL => $skin_url, CURLOPT_HEADER => true, CURLOPT_POST => 1, CURLOPT_HTTPHEADER => $headers, CURLOPT_POSTFIELDS => $fields, CURLOPT_RETURNTRANSFER => true);
// cURL options
curl_setopt_array($ch, $options);
$result = urldecode(curl_exec($ch));
curl_close($ch);
if (strlen(strstr($result, "success=Your skin has been changed! It will take a couple of seconds for it to update.")) > 0) {
return true;
} else {
return false;
}
}
示例2: getCurrentGameWeekFromDOM
function getCurrentGameWeekFromDOM($DOMDoc)
{
$finder = new DomXPath($DOMDoc);
$classname = "ismH2HStandingsTable";
$gameWeeks = $finder->query("//*[contains(@class, '{$classname}')]/tbody/tr/td/a");
return get_string_between($gameWeeks->item(1)->getAttribute('href'), '/event-history/', '/');
}
示例3: parse
function parse($txt)
{
$err = true;
//$str = strip_tags($txt);
$str = preg_replace('/\\s\\s+/', ' ', $txt);
$str = trim($str);
$data_size = substr_count($txt, '<tr');
$w = explode("<tr", $txt);
$j = 0;
for ($i = 2; $i <= $data_size; $i++) {
$pos1 = strpos($w[$i], '>') + 1;
$pos2 = strlen($w[$i]);
$dif = $pos2 - $pos1;
$txt2 = substr($w[$i], $pos1, $dif);
$v = explode("</td>", $txt2);
$ticker_link = get_string_between($v[1], ">", "</td>");
$ticker = get_string_between($ticker_link, "name=", "'");
$array[$j][0] = $ticker;
for ($k = 1; $k < 9; $k++) {
$p1 = strpos($v[$k + 1], ">");
$var = trim(substr($v[$k + 1], $p1 + 1, strlen($v[$k + 1]) - $p1));
if ($var != 'n/a' && $var != '') {
$array[$j][$k] = $var;
} else {
$array[$j][$k] = 0;
}
}
$j++;
}
return $array;
}
示例4: errorCheck
function errorCheck()
{
//check for error
global $return, $data_contact, $url_curl, $userpwd, $content, $to_error, $headers, $modify, $url_contacts, $entityID;
$status = 'default';
$status = get_string_between($return, 'status":"', '"');
$errorMessage = get_string_between($return, 'message":"', '"');
if ($status !== "ok") {
if (begins_with($errorMessage, "A duplicate record has been found")) {
$modify = 'True';
//if contacts table
if ($url_curl == $url_contacts) {
$entityID = filter_var($errorMessage, FILTER_SANITIZE_NUMBER_INT);
}
$url_curl = $url_curl . '/' . $entityID;
sendData();
} else {
//set email variables
$subject = 'Error: Hobson Radius Form';
$message = 'There has been an error on the Hobson Radious Form Submission
Status: ' . $status . '
***Modify: ' . $modify . '
***Error: ' . $errorMessage . '
***url:' . $url_curl . '
***entityID:' . $entityID . '
***error return:' . $return . '
data send:' . print_r($data_contact, true);
//send email
mail($to_error, $subject, $message, $headers);
}
}
}
示例5: cond
/**
* Adds if statement logic to change output based on if statement.
*
*
* @param mixed &$parsed
* @return void
*/
function cond(&$parsed)
{
global $cssp, $browser;
foreach ($parsed as $block => $css) {
foreach ($parsed[$block] as $selector => $styles) {
foreach ($styles as $property => $values) {
if (strpos($values[0], 'cond(') !== false) {
/**
* Clean up variable names and Formatting.
*/
$condition = get_string_between($values[0], "cond(", ")");
$ifParams = explode("?", $condition);
$ifResults = explode(":", $ifParams[1]);
$ifCond = explode(" ", $ifParams[0]);
$ifCond[0] = interp($ifCond[0]);
//Convert PHP string to Values
$ifCond[2] = interp($ifCond[2]);
//Convert PHP string to Values
$test = compare($ifCond[0], $ifCond[1], $ifCond[2]);
$parsed[$block][$selector][$property] = '';
//Remove existing Cond Statement
if ($test) {
$parsed[$block][$selector][$property][] = $ifResults[0];
//Place True Value
} else {
$parsed[$block][$selector][$property][] = $ifResults[1];
//Place False Value
}
}
}
}
}
}
示例6: js_compile
function js_compile($file, $js_replace)
{
$filedata = file_get_contents($file);
//load file
$js_includes = get_string_between($filedata, "<!--JS Compile Start-->", "<!--JS Compile Stop-->");
$script_array = js_include_parse($js_includes);
return concatenate_js($script_array, dirname($file), $js_replace);
}
示例7: css_compile
function css_compile($file)
{
$filedata = file_get_contents($file);
//load file
$css_includes = get_string_between($filedata, "<!--CSS Compile Start-->", "<!--CSS Compile Stop-->");
$styles_array = css_include_parse($css_includes);
return concatenate_css($styles_array, dirname($file));
}
示例8: update_versions
function update_versions()
{
$jdata = json_decode(get_string_between(file_get_contents("../../../js/version.js"), "/*START*/", "/*STOP*/"), true);
$jdata["build"]++;
$jdata["date"] = microtime(true);
$json_enc = json_encode($jdata);
$json_version = "/*Auto-Generated Ajax Animator Version config (Markup Version II)*/\n/*Generated By versions.php in /server/dev/compile/*/\nAx.set_version( /*START*/\n{$json_enc}\n/*STOP*/ )\n/*End Of File*/\n";
file_put_contents("../../../js/version.js", $json_version);
return $jdata["release"] . ".build" + $jdata["build"];
}
示例9: __construct
function __construct($config_path){
// extract the config name with some string magic get string between / and .php
// check if only file name was provided
$start = (!strpos($config_path,'/')?'':'/');
$this->config_name = get_string_between($config_path,$start,'.php');
$this->e_file = $config_path;
$this->html = self::get_config();
// we're using a post variable. Obviously if you didn't want to use this class you can write your own config files
$this->html .=($_POST && $_POST['Update']?self::writeConfig():NULL);
// I refresh it to avoid invalid form updates conflicts inside the object
if($_POST && $_POST['Update']) self::reload_form(5);
}
示例10: gen_html
function gen_html($input)
{
while (strpos($input, "<!--Remove Start-->") !== false) {
$input = str_replace("<!--Remove Start-->" . get_string_between($input, "<!--Remove Start-->", "<!--Remove Stop-->") . "<!--Remove Stop-->", "", $input);
}
$input = str_replace("<!--Start Compile Include>", "", $input);
$input = str_replace("<End Compile Include-->", "", $input);
$input = str_replace("<!--COMPILIER INFO-->", "<!--" . file_get_contents("compilierinfo.txt") . "-->", $input);
$input = sanitize_output($input);
$input = str_replace("<!--ADS-->", file_get_contents("ads.txt"), $input);
return $input;
}
示例11: finishValidation
/**
* finishValidation method
* @return array
* */
protected function finishValidation()
{
foreach ($this->fields as $field) {
for ($i = 0; $i < sizeof($field['rules']); $i++) {
$args = array();
$args[] = isset($_REQUEST[$field['name']]) ? $_REQUEST[$field['name']] : null;
if (strpos($field['rules'][$i], '[') !== FALSE) {
$cleanString = get_string_between($field['rules'][$i]);
$arg = str_replace('[', '', str_replace(']', '', $cleanString));
$rule = str_replace($cleanString, '', $field['rules'][$i]);
switch ($rule) {
case "matchWith":
$args[] = isset($_REQUEST[$arg]) ? $_REQUEST[$arg] : null;
break;
case "between":
$betweenParts = explode(',', $arg);
if (isset($betweenParts[0])) {
if (preg_match('/^[0-9]*$/', $betweenParts[0])) {
$args[] = $betweenParts[0];
} else {
exit('between first argument must be integer');
}
if (isset($betweenParts[1])) {
if (preg_match('/^[0-9]*$/', $betweenParts[1])) {
$args[] = $betweenParts[1];
} else {
exit('between second argument must be integer');
}
} else {
exit('between second argument is required');
}
} else {
exit('between first argument is required');
}
break;
}
$args[] = $arg;
} else {
$rule = $field['rules'][$i];
}
$key = str_replace('[', '', str_replace(']', '', $rule));
if (!call_user_func_array($this->getValidationTypes()[$key], $args)) {
$this->error[$field['label']] = $key;
}
}
}
$this->status = sizeof($this->getError()) > 0 ? 'error' : 'success';
}
示例12: getEmailfromWeb
function getEmailfromWeb($websiteurl)
{
$strarr = array('', 'contact.html', 'contact.htm', 'contact.php', 'contact', 'contactus.html', 'contactus.htm', 'contactus.php', 'contactus', 'contact_us.html', 'contact_us.htm', 'contact_us.php', 'contact_us', 'contact-us.html', 'contact-us.htm', 'contact-us.php', 'contact-us', 'about.html', 'about.htm', 'about.php', 'about', 'aboutus.html', 'aboutus.htm', 'aboutus.php', 'aboutus', 'about_us.html', 'about_us.htm', 'about_us.php', 'about_us', 'about-us.html', 'about-us.htm', 'about-us.php', 'about-us', 'feedback.html', 'feedback.htm', 'feedback.php', 'feedback');
foreach ($strarr as $str) {
$url = $websiteurl . '/' . $str;
$url = str_replace('//' . $str, '/' . $str, $url);
$content = get_data($url);
if ($content == '') {
// $content = @file_get_contents($url);
}
if ($content != '') {
//$emails = extract_emails_from($content);
$emails = extract_email_address($content);
if (count($emails) > 0) {
$emails = array_unique($emails);
return $emails;
}
$emails = extract_emails_from($content);
if (count($emails) > 0) {
$emails = array_unique($emails);
return $emails;
}
if (strpos($content, 'mailto:') !== false) {
$content = html_entity_decode($content);
$emails = array();
$email_temp = get_string_between($content, 'mailto:', '>');
$emails[0] = explode(' ', $email_temp);
if (count($emails) > 0 && $emails[0] != '') {
return $emails;
}
}
$emails = extract_emails_from($content);
if (count($emails) > 0) {
$emails = array_unique($emails);
return $emails;
}
} else {
echo $url . " Content could not be fetched.<br />";
}
//sleep(rand(5,10));
}
return '';
}
示例13: errorCheck
function errorCheck()
{
/*check for error
Hobson returns a string after form submission. We need to parse the string to determine the error.
*/
global $return, $data_contact, $url_curl, $userpwd, $content, $to_error, $headers, $modify, $url_contacts, $entityID;
$status = 'default';
$status = get_string_between($return, 'status":"', '"');
$errorMessage = get_string_between($return, 'message":"', '"');
//if we are ok, then there is not error and we can move on.
if ($status !== "ok") {
if (begins_with($errorMessage, "A duplicate record has been found")) {
//The record already exists in the database, prepare to resubmit using the Modify/Put Method.
$modify = 'True';
//if contacts table
if ($url_curl == $url_contacts) {
$entityID = filter_var($errorMessage, FILTER_SANITIZE_NUMBER_INT);
}
$url_curl = $url_curl . '/' . $entityID;
sendData();
} else {
//prepare variables for email
$subject = 'Error: Hobson Radius Form';
$message = 'There has been an error on the Hobson Radious Form Submission
Status: ' . $status . '
***Modify: ' . $modify . '
***Error: ' . $errorMessage . '
***url:' . $url_curl . '
***entityID:' . $entityID . '
***error return:' . $return . '
data send:' . print_r($data_contact, true);
//send email
mail($to_error, $subject, $message, $headers);
}
}
//send email
mail($to_error, $subject, $message, $headers);
}
示例14: getDetails
function getDetails($plugin)
{
if ($this->request->is('ajax')) {
$this->disableCache();
$this->autoRender = false;
$api = json_decode(file_get_contents("http://api.bukget.org/api2/bukkit/plugin/" . $plugin), TRUE);
//debug($api);
//Function to get strings
function get_string_between($string, $start, $end)
{
$string = " " . $string;
$ini = strpos($string, $start);
if ($ini == 0) {
return "";
}
$ini += strlen($start);
$len = strpos($string, $end, $ini) - $ini;
return substr($string, $ini, $len);
}
$status = $api['stage'];
$categories = implode(', ', $api['categories']);
$authors = implode(', ', $api['authors']);
$desc = $api['description'];
$data = file_get_contents($api['link']);
$img = get_string_between($data, 'data-full-src="', '"');
echo <<<END
<ul>
<li>
<b>Status</b>
<p>{$status}</p>
</li>
<li>
<b>Categories</b>
<p>{$categories}</p>
</li>
<li>
<b>Authors</b>
<p>{$authors}</p>
</li>
<li>
<b>Description</b>
<p>
<img src="{$img}" width="250px" />
{$desc}
</p>
</li>
</ul>'
END;
}
}
示例15: makeJsonTrace
}
//on ecrit les données dans le fichier json trace
System_Daemon::info("Initialisation du fichier knxtrace.json");
makeJsonTrace($sniffed);
/*
Mise a jour du ficheir knxtrace.json a chaque modification d'un equipement suivi
*/
System_Daemon::info("Mise a jour du fichier knxtrace.json a chaque modification d'un equipement suivi et sauvegarde en base s'il doit etre historisé");
//$lastpos = 0;
while (true) {
// On tail le fichier de log
$knxlisten = tail(PATH_LOG, $lastpos);
// On r�agit d�s qu'on a un Write
// Pour chaque ligne, on r�cup�re le Groupe d'Addresse et de la valeur qu'on converti
$groupaddr = get_string_between($knxlisten, 'group addr: ', ' -');
$hexa = get_string_between($knxlisten, 'Hexa: ', ' -');
//on met a jour le valeur dans le tableau et on regenere le fichier json
//recursive_array_search
if (array_key_exists($groupaddr, $sniffed)) {
$decimal = hexdec($hexa);
$value = dptSelectDecode($sniffed[$groupaddr]['dpt'], $decimal);
//ecriture en base si changement d'etat et bas simplement l'equipement qui redis la meme chose sur le bus
//System_Daemon::notice("Old Value -> ".$groupaddr.":: ".$oldSniffedValue[$groupaddr]);
//System_Daemon::notice("New Value -> ".$groupaddr.":: ".$value);
if ($oldSniffedValue[$groupaddr] != $value) {
//System_Daemon::notice("MAJ");
$sniffed[$groupaddr]['value'] = $value;
makeJsonTrace($sniffed);
//System_Daemon::notice("TRACKED::".$sniffed[$groupaddr]['is_track']);
if ($sniffed[$groupaddr]['is_track'] == 1) {
//Inseetion en base de données car l'eqt is_track=true