本文整理汇总了PHP中curlGet函数的典型用法代码示例。如果您正苦于以下问题:PHP curlGet函数的具体用法?PHP curlGet怎么用?PHP curlGet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了curlGet函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getStaffvalue
function getStaffvalue($staff)
{
global $config;
$param = "objectlist/by-fieldvalue/" . urlencode($staff);
$url = $config['cmdb']['url'] . $param;
return curlGet($url);
}
示例2: priceAt2
function priceAt2($price, $name = 'Payment')
{
global $rateObj, $BTC_JSON_URL, $BTC_AVG_COM, $BTC_WINK;
$rateFile = 'rates.ser';
if (!isset($rateObj)) {
if (($fTime = @filemtime($rateFile)) && time() - $fTime > 1200) {
@unlink($rateFile);
}
if (($fRate = @file_get_contents($rateFile)) === false) {
$rateJS = curlGet("http://ws.goldmoney.com/metal/prices/currentSpotPrices?currency=usd&units=ounces");
$metals = json_decode($rateJS);
$rateObj = new stdClass();
foreach ($metals->spotPrices as $rate) {
$prc = $rate->spotPrice;
switch ($rate->metal) {
case 'au':
$rateObj->rateAu = $prc;
break;
case 'ag':
$rateObj->rateAr = $prc;
break;
}
}
$btc = curlGet($BTC_JSON_URL);
if ($btc > '' && ($rates = json_decode($btc))) {
$rates = get_object_vars($rates->USD);
$rateObj->rateBTC = $rates['24h'];
} else {
$btc = curlGet($BTC_AVG_COM);
if ($rates = json_decode($btc)) {
$rates = get_object_vars($rates);
$rateObj->rateBTC = $rates['24h_avg'];
} else {
$btc = curlGet($BTC_WINK);
if ($rates = json_decode($btc)) {
$rates = get_object_vars($rates);
$rateObj->rateBTC = $rates['price'] / 100;
} else {
$rateObj->rateBTC = -1;
}
}
}
$fRate = serialize($rateObj);
file_put_contents($rateFile, $fRate, LOCK_EX);
}
$rateObj = unserialize($fRate);
if ($rateObj->rateBTC == -1) {
@unlink($rateFile);
}
}
echo "<!-- btc3: {$btc}, -->";
$inAr = $rateObj->rateAr > 0 ? number_format($price / $rateObj->rateAr, 3) : 'N/A';
$inAuz = $rateObj->rateAu > 0 ? number_format($price / $rateObj->rateAu, 5) : 'N/A';
$inAu = $rateObj->rateAu > 0 ? number_format($price / $rateObj->rateAu * 31.1034768, 3) : 'N/A';
$inBTC = $rateObj->rateBTC > 0 ? number_format($price / $rateObj->rateBTC, 5) : 'N/A';
$pp1 = "https://www.paypal.com/cgi-bin/webscr?cmd=_cart&business=JGMXUNFVK7U94&lc=US";
$pp2 = "¤cy_code=USD&button_subtype=products&add=1&bn=PP%2dShopCartBF%3abtn_cart_LG%2egif%3aNonHosted";
echo " <a href='{$pp1}&item_name={$name}&amount={$price}{$pp2}'\r\n title='Pay with Paypal'>\${$price}.00</a>\r\n (<select>\r\n <option>Or Real Money...</option>\r\n <option>{$inAr} oz. Silver</option>\r\n <option>{$inAu} grams gold</option>\r\n <option>{$inAuz} troy oz. gold</option>\r\n <option>{$inBTC} bitcoins</option></select>)";
}
示例3: geturls
function geturls($url)
{
$data = curlGet($url);
print_r($data);
preg_match_all('/http:\\/\\/mp.weixin.qq.com\\/s(.*)#rd/', $data, $urls);
$urls = array_unique($urls[0]);
//return $urls;
}
示例4: doOutboundCall
function doOutboundCall($from, $to)
{
global $api_key, $api_url;
$call_url = 'http://www.kookoo.in/outbound/outbound.php?phone_no=' . $from . '&api_key=' . $api_key;
$callback_url = $api_url . '/agentcustomerflow.php?custno=' . $to . '&agentid=' . $from;
$call_url .= '&url=' . rawurlencode($callback_url);
curlGet($call_url);
}
示例5: get_description
function get_description($url)
{
$fullpage = curlGet($url);
$dom = new DOMDocument();
@$dom->loadHTML($fullpage);
$xpath = new DOMXPath($dom);
$tags = $xpath->query('//div[@class="info-description-body"]');
foreach ($tags as $tag) {
$my_description .= trim($tag->nodeValue);
}
return utf8_decode($my_description);
}
示例6: yaml_parse_file
echo "--- xAuth Auto-Updater ---", PHP_EOL;
$version = yaml_parse_file("phar://" . __FILE__ . "/plugin.yml")["version"];
echo "Current version: {$version}", PHP_EOL;
echo "Checking for new versions from GitHub...", PHP_EOL;
$ret = curlGet("https://api.github.com/repos/xxFlare/xAuth/releases", 5);
if (strlen((string) $ret) > 0) {
$data = json_decode($ret);
if (is_array($data) and isset($data[0])) {
$first = $data[0];
$name = $first->tag_name;
if (version_compare($version, $name, '<') and !$version->prerelease) {
echo "Updating to version {$name}...", PHP_EOL;
$assets = $first->assets;
foreach ($assets as $asset) {
if ($asset->name === "xAuth.phar") {
$phar = curlGet($asset->browser_download_url);
file_put_contents(__FILE__, $phar);
echo "Updated!", PHP_EOL;
exit(0);
}
}
}
}
}
echo "Not updated.", PHP_EOL;
exit(1);
function curlGet($url, $timeout)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array_merge(["User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0 xAuth-Updater"], $extraHeaders));
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
示例7: isset
<?php
require_once 'basic.php';
# Google Image Scraping
if (isset($_GET['q']) && !empty($_GET['q'])) {
$count = 0;
$urlFormat = 'https://www.google.co.id/search?tbm=isch&start=%s&q=%s';
$fImg = '<img src="%s" alt="%s">';
$limit = isset($_GET['limit']) && is_numeric($_GET['limit']) ? $_GET['limit'] : 500;
$q = urlencode($_GET['q']);
while (true) {
$page = curlGet(sprintf($urlFormat, $count, $q));
$cleanPage = htmlspecialchars_decode($page);
$doc = new DOMDocument();
@$doc->loadHTML($cleanPage);
$imageTags = $doc->getElementsByTagName('img');
foreach ($imageTags as $tag) {
$parent = $tag->parentNode;
if ($parent->tagName == 'a' && $count < $limit) {
printf($fImg, $tag->getAttribute('src'), 'Kristen Stewart');
++$count;
}
}
if ($imageTags->length <= 1 || $count >= $limit) {
break;
}
}
} else {
echo 'q is missing.';
}
示例8: count
$url = $api;
$i = 0;
$sum = count($_GET);
foreach ($_GET as $k => $v) {
if ($k == "chl" || $k == "chdl") {
$v = urlencode($v);
}
$i++;
if ($i < $sum) {
$url .= $k . "=" . $v . "&";
} else {
$url .= $k . "=" . $v;
}
}
//die($url);
/*
if(isset($_GET['cht'])) {
$cht = $_GET['cht'];
}
if(isset($_GET['chl'])) {
$chl = $_GET['chl'];
}
if(isset($_GET['chof'])) {
$chof = $_GET['chof'];
}
$chl = urlencode($chl);
$url = $api . $cht . "&chl=" . $chl . "&chof=" . $chof;
*/
header("Content-Type: image/webp; charset=UTF-8");
$data = curlGet($url);
die($data);
示例9: Parse
function Parse($rss_url)
{
// Open and load RSS file
if ($rss_content = curlGet($rss_url)) {
// Parse document encoding
$result['encoding'] = $this->my_preg_match("'encoding=[\\'\"](.*?)[\\'\"]'si", $rss_content);
// if document codepage is specified, use it
if ($result['encoding'] != '') {
$this->rsscp = $result['encoding'];
} else {
$this->rsscp = $this->default_cp;
}
// This is used in my_preg_match()
// Parse CHANNEL info
preg_match("'<channel.*?>(.*?)</channel>'si", $rss_content, $out_channel);
foreach ($this->channeltags as $channeltag) {
$temp = $this->my_preg_match("'<{$channeltag}.*?>(.*?)</{$channeltag}>'si", $out_channel[1]);
if ($temp != '') {
$result[$channeltag] = $temp;
}
// Set only if not empty
}
// If date_format is specified and lastBuildDate is valid
if ($this->date_format != '' && ($timestamp = strtotime($result['lastBuildDate'])) !== -1) {
// convert lastBuildDate to specified date format
$result['lastBuildDate'] = date($this->date_format, $timestamp);
}
// Parse TEXTINPUT info
preg_match("'<textinput(|[^>]*[^/])>(.*?)</textinput>'si", $rss_content, $out_textinfo);
// This a little strange regexp means:
// Look for tag <textinput> with or without any attributes, but skip truncated version <textinput /> (it's not beggining tag)
if (isset($out_textinfo[2])) {
foreach ($this->textinputtags as $textinputtag) {
$temp = $this->my_preg_match("'<{$textinputtag}.*?>(.*?)</{$textinputtag}>'si", $out_textinfo[2]);
if ($temp != '') {
$result['textinput_' . $textinputtag] = $temp;
}
// Set only if not empty
}
}
// Parse IMAGE info
preg_match("'<image.*?>(.*?)</image>'si", $rss_content, $out_imageinfo);
if (isset($out_imageinfo[1])) {
foreach ($this->imagetags as $imagetag) {
$temp = $this->my_preg_match("'<{$imagetag}.*?>(.*?)</{$imagetag}>'si", $out_imageinfo[1]);
if ($temp != '') {
$result['image_' . $imagetag] = $temp;
}
// Set only if not empty
}
}
// Parse ITEMS
preg_match_all("'<item(| .*?)>(.*?)</item>'si", $rss_content, $items);
$rss_items = $items[2];
$i = 0;
$result['items'] = array();
// create array even if there are no items
foreach ($rss_items as $rss_item) {
// If number of items is lower then limit: Parse one item
if ($i < $this->items_limit || $this->items_limit == 0) {
foreach ($this->itemtags as $itemtag) {
$temp = $this->my_preg_match("'<{$itemtag}.*?>(.*?)</{$itemtag}>'si", $rss_item);
if ($temp != '') {
$result['items'][$i][$itemtag] = $temp;
}
// Set only if not empty
}
// Strip HTML tags and other bullshit from DESCRIPTION
if ($this->stripHTML && $result['items'][$i]['description']) {
$result['items'][$i]['description'] = strip_tags($this->unhtmlentities(strip_tags($result['items'][$i]['description'])));
}
// Strip HTML tags and other bullshit from TITLE
if ($this->stripHTML && $result['items'][$i]['title']) {
$result['items'][$i]['title'] = strip_tags($this->unhtmlentities(strip_tags($result['items'][$i]['title'])));
}
// If date_format is specified and pubDate is valid
if ($this->date_format != '' && ($timestamp = strtotime($result['items'][$i]['pubDate'])) !== -1) {
// convert pubDate to specified date format
$result['items'][$i]['pubDate'] = date($this->date_format, $timestamp);
}
// Item counter
$i++;
}
}
$result['items_count'] = $i;
return $result;
} else {
return False;
}
}
示例10: curlGet
*
* RuneAudio website and logo
* copyright (C) 2013-2014 - ACX webdesign (Andrea Coiutti)
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RuneAudio; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.txt>.
*
* file: app/tun_ctl.php
* version: 1.3
* coder: Simone De Gregori
*
*/
// disable main template output
$tplfile = 0;
$proxy = $redis->hGetall('proxy');
if ($proxy['enable'] === '1') {
echo curlGet(substr($_SERVER["REQUEST_URI"], 5), $proxy);
} else {
echo curlGet(substr($_SERVER["REQUEST_URI"], 5));
}
示例11: simplexml_load_string
<?php
$postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
$postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
// 给下列参数赋值
/*$appid= AppId;
$secret= AppSecret;
$appkey= 支付专用签名串PaySignKey*/
$appid = 'wxfea3e92ddf4936d5';
$secret = '674828c37381378ba816825c3d533a82';
$appkey = 'd1qOVI3KEMQWz2uX2koFros8U2NZpTN5CX8JU6cN50UU4SO38fqRKZ3GD8jv3Ut6UzMmChnc1JerftH1Opdg0hnCW4GC35f09HCkqad3ashj9MVJVVSglknlMZMsJCgi';
$url_get = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . $appid . '&secret=' . $secret;
$json = json_decode(curlGet($url_get));
$access_token = $json->access_token;
$openid = $postObj->OpenId;
$deliver_msg = "ok";
$deliver_status = "1";
$deliver_timestamp = time();
$out_trade_no = $_GET['out_trade_no'];
$transid = $_GET['transaction_id'];
$sign = getSign($appid, $appkey, $deliver_msg, $deliver_status, $deliver_timestamp, $openid, $out_trade_no, $transid);
$url = "https://api.weixin.qq.com/pay/delivernotify?access_token=" . $access_token;
$data = '{
"appid" : "' . $appid . '",
"openid" : "' . $openid . '",
"transid" : "' . $transid . '",
"out_trade_no" : "' . $out_trade_no . '",
"deliver_timestamp" : "' . $deliver_timestamp . '",
"deliver_status" : "' . $deliver_status . '",
"deliver_msg" : "' . $deliver_msg . '",
"app_signature" : "' . $sign . '",
示例12: die
// plain text
$my_description = 'Description';
// plain text
$my_link = 'http://www.youtube.com/user/username/';
// full URL to show homepage
$my_install_url = 'http://example.com/yt/';
// url where script is installed
/*
* URL where your cron job will save the feed output - this is used for the
* atom self-reference in the feed and should match where the feed will be
*/
$my_feed_url = 'http://example.com/feed.xml';
$itunes_image = 'http://example.com/photo.jpg';
/* nothing to configure below here */
include_once 'curl.php';
if ($rs = curlGet($source_feed)) {
//print_r($rs);
} else {
die('Error: Feed file not found, dude.');
}
$my_videos = simplexml_load_string($rs);
/* write out the outer shell, channel, globals */
$updated = $my_videos->updated;
$updated = date("D, d M Y H:i:s T", strtotime($updated));
$output = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n\t<rss version=\"2.0\" xmlns:itunes=\"http://www.itunes.com/dtds/podcast-1.0.dtd\"\r\n\t\t xmlns:atom=\"http://www.w3.org/2005/Atom\">\t\r\n\t<channel>\r\n\t\t<title>{$my_title}</title>\r\n\t\t<link>{$my_link}</link>\r\n\t\t<description>{$my_description}</description>\r\n\t\t<image>\r\n\t\t\t<url>{$itunes_image}</url>\r\n\t\t\t<link>{$my_link}</link>\r\n\t\t\t<description>{$my_title}</description>\r\n\t\t\t<title>{$my_title}</title>\r\n\t\t</image>\r\n\t\t<language>en-us</language>\r\n\t\t<lastBuildDate>{$updated}</lastBuildDate>\r\n\t\t<pubDate>{$updated}</pubDate>\r\n\t\t<itunes:explicit>no</itunes:explicit>\r\n\t\t<atom:link href=\"{$my_feed_url}\" rel=\"self\" type=\"application/rss+xml\" /> \r\n\r\n\t\t";
/* now get the info on each item in the feed */
foreach ($my_videos as $entry) {
$pubDate = $entry->published;
$pubDate = date("D, d M Y H:i:s T", strtotime($pubDate));
$videoid = explode('/', $entry->id);
$item_url = htmlentities($entry->link[0]['href']);
示例13: curlGet
//}
//
//$auth->streaming('user', function ($stream) use ($screen_name) {
//
////$auth->streaming('statuses/sample', function ($status) {
//
// if (isset($stream->friends)) {
// echo "friends : ", count($stream->friends);
// }
// if (isset($stream->text) && $stream->user->screen_name === $screen_name) {
// echo "tweet: {$stream->user->screen_name}";
// }
//
//});
$endpoint_url = "https://profsnapshot.suzutan.jp/api/snapshot/list.json";
$result = curlGet($endpoint_url, ["hello"]);
var_dump($result);
function curlGet($url, $params = [])
{
$ch = curlInit($url);
curl_setopt_array($ch, [CURLOPT_URL => $url . ($params ? "?" . http_build_query($params, "", "&") : ""), CURLOPT_POST => false]);
$response = curlAction($ch);
return $response;
}
function curlPost($url, $params = [])
{
$ch = curlInit($url);
curl_setopt_array($ch, [CURLOPT_URL => $url, CURLOPT_POST => true, CURLOPT_POSTFIELDS => http_build_query($params, '', '&')]);
$response = curlAction($ch);
return $response;
}
示例14: getLinks
function getLinks($my_id = NULL, $my_type = NULL, $debug = NULL)
{
include_once 'curl.php';
//----------------------------------------------------------
//init var
//----------------------------------------------------------
$chk = array("bool" => true, 'result' => array(), "func" => "getLinks");
//----------------------------------------------------------
if (isset($_REQUEST['videoid']) && is_null($my_id)) {
$my_id = $_REQUEST['videoid'];
} else {
if (is_null($my_id)) {
$chk['bool'] = false;
$chk['message'] = 'No video id passed in';
return $chk;
}
}
if (isset($_REQUEST['type']) && is_null($my_type)) {
$my_type = $_REQUEST['type'];
} else {
if (is_null($my_type)) {
$my_type = 'redirect';
}
}
if (isset($_REQUEST['debug']) && is_null($debug)) {
$debug = TRUE;
} else {
if (is_null($debug)) {
$debug = FALSE;
}
}
if ($my_type == 'Download') {
}
// end of if for type=Download
/* First get the video info page for this video id */
$my_video_info = 'http://www.youtube.com/get_video_info?&video_id=' . $my_id;
$my_video_info = curlGet($my_video_info);
/* TODO: Check return from curl for status code */
$thumbnail_url = $title = $url_encoded_fmt_stream_map = $type = $url = '';
parse_str($my_video_info);
if ($thumbnail_url == "") {
$chk['bool'] = false;
$chk['message'] = "Check if video id was written correctly.";
}
/*if ($video['bool'] && !$chk['bool']) {
$video['result'] = $video['result'][0];
$video['result']['formats'] = $chk['result']['formats'];
return $chk = $video;
} else if(!$chk['bool']){
return $chk;
}*/
$chk['result']['img_url'] = $this->thumbnail_url = $thumbnail_url;
$this->my_title = $title;
//if (!$video['bool']) $chk['result']['title'] = stripslashes($my_title);
if (isset($url_encoded_fmt_stream_map)) {
/* Now get the url_encoded_fmt_stream_map, and explode on comma */
$my_formats_array = explode(',', $url_encoded_fmt_stream_map);
//if($debug) {
// echo '<pre>';
// print_r($my_formats_array);
// echo '</pre>';
//}
} else {
$chk['bool'] = false;
$chk['message'] = 'No encoded format stream found.Here is what we got from YouTube:' . $my_video_info;
}
if (count($my_formats_array) == 0 || $my_formats_array[0]['ip'] == "" && $my_formats_array[0]['type'] == "") {
$chk['bool'] = false;
$chk['message'] = 'No format stream map found - was the video id correct?';
return $chk;
}
/* create an array of available download formats */
$avail_formats[] = '';
$i = 0;
$ipbits = $ip = $itag = $sig = $quality = '';
$expire = time();
foreach ($my_formats_array as $format) {
parse_str($format);
$avail_formats[$i]['itag'] = $itag;
$avail_formats[$i]['quality'] = $quality;
$type = explode(';', $type);
$avail_formats[$i]['type'] = $type[0];
$avail_formats[$i]['url'] = urldecode($url) . '&signature=' . $sig;
parse_str(urldecode($url));
$avail_formats[$i]['expires'] = date("G:i:s T", $expire);
$avail_formats[$i]['ipbits'] = $ipbits;
$avail_formats[$i]['ip'] = $ip;
$avail_formats[$i]['download'] = "http://" . $_SERVER["HTTP_HOST"] . str_replace($_SERVER['DOCUMENT_ROOT'], "", "/var/chroot" . dirname(__FILE__)) . '/download.php?mime=' . $avail_formats[$i]['type'] . '&title=' . urlencode($my_title) . '&token=' . base64_encode($avail_formats[$i]['url']);
$i++;
}
$chk['result']['formats'] = $avail_formats;
//file_put_contents("files/Tmpfile.flv", fopen($avail_formats[0]['url'], 'r'));
if ($debug) {
echo '<p>These links will expire at ' . $avail_formats[0]['expires'] . '</p>';
echo '<p>The server was at IP address ' . $avail_formats[0]['ip'] . ' which is an ' . $avail_formats[0]['ipbits'] . ' bit IP address. ';
echo 'Note that when 8 bit IP addresses are used, the download links may fail.</p>';
}
if ($my_type == 'Download') {
echo $avail_formats;
} else {
//.........这里部分代码省略.........
示例15: curlGet
// downloading pages with list of products
<?php
function curlGet($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_URL, $url);
$results = curl_exec($ch);
curl_close($ch);
return $results;
}
for ($i = 1; $i <= 97; $i++) {
echo "downloading page" . $i;
$down = curlGet("http://www.kaymu.com.np/mobile-phones/?page={$i}");
file_put_contents("/home/spontaneous/Desktop/kaymu/mobile/page{$i}", $down);
}