本文整理汇总了PHP中get_curl函数的典型用法代码示例。如果您正苦于以下问题:PHP get_curl函数的具体用法?PHP get_curl怎么用?PHP get_curl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_curl函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: saveToken
function saveToken($token)
{
$dotenv = new \Dotenv\Dotenv(__DIR__ . '/../');
$dotenv->load();
$tumblr = getenv('TUMBLR_ACCESS_TOKEN');
$url = 'https://api.vk.com/method/users.get?access_token=' . $token;
$response = json_decode(get_curl($url));
if (!isset($response->error)) {
$user_id = $response->response[0]->uid;
$string = file_get_contents(__DIR__ . "/../.env");
$envArr = explode("\n", $string);
$envToken = explode('=', $envArr[0]);
$envUID = explode('=', $envArr[1]);
$envToken[1] = $token;
$envUID[1] = $user_id;
$string = $envToken[0] . '=' . $envToken[1] . "\n" . $envUID[0] . '=' . $envUID[1] . "\nTUMBLR_ACCESS_TOKEN=" . $tumblr;
$fp = fopen(__DIR__ . '/../.env', 'w');
fputs($fp, $string);
fclose($fp);
echo '<script>document.location.href = "http://localhost:8888";</script>';
return true;
} else {
echo 'Error. Please check your access token<br>';
echo '<a href="../index.php">Back</a>';
return false;
}
}
开发者ID:shpikyliak,项目名称:tumlrVkProject,代码行数:27,代码来源:saveToken.php
示例2: uploadImg
function uploadImg($photosPost)
{
$dotenv = new \Dotenv\Dotenv(__DIR__ . '/../');
$dotenv->load();
$token = $_ENV['VK_ACCESS_TOKEN'];
$user_uid = $_ENV['USER_UID'];
$vk = \getjump\Vk\Core::getInstance()->apiVersion('5.5')->setToken($token);
$url = 'https://api.vk.com/method/photos.getWallUploadServer?group_id=101646894&v=5.5&access_token=' . $token;
$request = get_curl($url);
$data = json_decode($request);
$link = $data->response->upload_url;
$photo = explode('/||/', $photosPost);
$group_id = '101646894';
$postParams = array();
$index = 0;
for ($i = 1; $i < count($photo); $i++) {
$extention = explode(".", basename($photo[$i]));
if ($extention[1] == 'gif') {
echo 'You can\'t upload GIF';
die;
}
$index++;
$path = __DIR__ . "/../images/" . basename($photo[$i]);
file_put_contents($path, file_get_contents($photo[$i]));
$postParams["file" . $index] = "@" . $path;
}
if ($index < 7) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $link);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
@curl_setopt($ch, CURLOPT_POSTFIELDS, $postParams);
$response = curl_exec($ch);
$photoParams = json_decode($response);
$photo = $photoParams->photo;
$server = $photoParams->server;
$url = 'https://api.vk.com/method/photos.saveWallPhoto?group_id=' . $group_id . '&v=5.5&photo=' . $photo . '&server=' . $server . '&hash=' . $photoParams->hash . '&access_token=' . $token;
$an = get_curl($url);
$save = json_decode($an)->response;
$attachments = "";
for ($i = 0; $i < count($save); $i++) {
$attachments = $attachments . "photo" . $user_uid . "_" . $save[$i]->id . ',';
}
$url = 'https://api.vk.com/method/wall.post?owner_id=-' . $group_id . '&from_group=1&attachments=' . $attachments . '&access_token=' . $token;
$an = get_curl($url);
if (!isset(\GuzzleHttp\json_decode($an)->response)) {
echo "Unknown error";
return false;
} else {
echo "Images is successfully uploaded";
return true;
}
} else {
echo "ERROR! You upload more than 6 images OR all your pics are GIFs !";
return false;
}
}
开发者ID:shpikyliak,项目名称:tumlrVkProject,代码行数:57,代码来源:uploadVkImg.php
示例3: get_qqnick
function get_qqnick($uin)
{
if ($data = get_curl("http://users.qzone.qq.com/fcg-bin/cgi_get_portrait.fcg?get_nick=1&uins=" . $uin)) {
$data = str_replace(array('portraitCallBack(', ')'), array('', ''), $data);
$data = mb_convert_encoding($data, "UTF-8", "GBK");
$row = json_decode($data, true);
return $row[$uin][6];
}
}
开发者ID:sembrono,项目名称:mz,代码行数:9,代码来源:search.php
示例4: get_menuid
/**
* 获取新的菜单ID
* @return mixed
*/
public function get_menuid()
{
$apiurl = $this->apiurl . '&v=get_menuid&token=' . $this->token;
$data = get_curl($apiurl);
$data = json_decode($data, true);
if ($data['code'] != 100) {
MSG($data['msg']);
}
return $data['menuid'];
}
开发者ID:another3000,项目名称:wuzhicms,代码行数:14,代码来源:open_platform.class.php
示例5: request
function request($url, $postData = NULL, $followLocation = true)
{
$curl = get_curl($url);
if ($postData !== NULL) {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
}
curl_setopt($curl, CURLOPT_COOKIE, get_cookie());
$response = curl_exec($curl);
$ret = ['header' => []];
$head_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
$headerRaw = explode("\r\n", substr($response, 0, $head_size));
array_shift($headerRaw);
foreach ($headerRaw as $line) {
$exp = explode(': ', $line, 2);
if (!isset($exp[1])) {
continue;
}
if (strtolower($exp[0]) == 'set-cookie') {
set_cookie($exp[1]);
}
$ret['header'][strtolower($exp[0])] = $exp[1];
}
$body = substr($response, $head_size);
$ret['body'] = $body;
$ret['code'] = curl_getinfo($curl, CURLINFO_HTTP_CODE);
$ret['error'] = curl_error($curl);
$ret['real_url'] = $url;
if (isset($ret['header']['location']) && $followLocation) {
global $redirect_cnt;
$redirect_cnt += 1;
if ($redirect_cnt > 10) {
echo 'Max redirect count excceed!<br />Last url: ' . $url . '<br />Request result: <br />';
print_r($ret);
die;
}
$redirect_cnt = 0;
$location = $ret['header']['location'];
if (substr($location, 0, 4) == 'http') {
return request($location);
} else {
if ($location[0] === '/') {
return request(substr($url, 0, strpos($url, '/', 8) + 1) . $location);
} else {
return request(substr($url, 0, strrpos($url, '/') + 1) . $location);
}
}
}
return $ret;
}
开发者ID:NijiharaTsubasa,项目名称:BaiduPanAutoReshare,代码行数:50,代码来源:curl.php
示例6: qqpanduan
function qqpanduan($p)
{
if (!strpos($p, ':')) {
$p .= ':';
}
$url = 'http://webpresence.qq.com/getonline?Type=1&' . $p;
$get = get_curl($url);
preg_match_all('/online\\[(\\d+)\\]=(\\d+)\\;/ix', $get, $arr);
if ($arr[2][0] == 1) {
return '在线';
} else {
return '离线';
}
}
开发者ID:sembrono,项目名称:mz,代码行数:14,代码来源:wall.php
示例7: get_content
function get_content($url, $config)
{
$html = get_curl($url);
$html = str_replace(array("\r", "\n"), "", $html);
foreach ($config['fields'] as $field => $_c) {
if (isset($_c['func'])) {
$tmp = cut_html($html, $_c['start'], $_c['end']);
$func = $_c['func'];
$data[$field] = $func($tmp, $_c['func_result']);
} else {
$data[$field] = cut_html($html, $_c['start'], $_c['end']);
if (isset($_c['replace_code'])) {
$data[$field] = replace_code($data[$field], $_c['replace_code']);
}
}
}
return $data;
}
开发者ID:another3000,项目名称:wuzhicms,代码行数:18,代码来源:collect_content.php
示例8: ifdx
function ifdx($qq, $jcqq, $sid)
{
$url = get_curl('http://m.qzone.com/friendship/get_friendship?g_tk=' . time() . '&fromuin=' . $jcqq . '&touin=' . $qq . '&isReverse=1&res_type=4&refresh_type=1&format=json&sid=' . $sid);
$json = json_decode($url, true);
//print_r($json);
if ($json["code"] == 0) {
if ($json["message"] == "请先登录") {
exit('{"code":-1,"msg":"SKEY已过期!"}');
} else {
if ($json["data"]["friendShip"][0]["add_friend_time"] == "-1") {
exit('{"code":0,"is":0}');
} else {
exit('{"code":0,"is":1}');
}
}
} else {
exit('{"code":-1,"msg":"' . $json["message"] . '"}');
}
}
开发者ID:sembrono,项目名称:mz,代码行数:19,代码来源:dx.php
示例9: ifdx
function ifdx($uin, $touin, $sid)
{
$url = "http://m.qzone.com/friendship/get_friendship?fromuin={$uin}&touin={$touin}&isReverse=1&res_type=4&refresh_type=1&format=json&sid={$sid}";
$json = get_curl($url, 0, 'http://m.qzone.com/infocenter?g_ut=3&g_f=6676');
$json = json_decode($json, true);
//print_r($json);
if ($json["code"] == 0) {
if ($json["message"] == "请先登录") {
exit('{"code":-1,"msg":"SID已过期!"}');
} else {
if ($json["data"]["friendShip"][0]["add_friend_time"] == "-1") {
exit('{"code":0,"is":0}');
} else {
exit('{"code":0,"is":1}');
}
}
} else {
exit('{"code":-2,"msg":"' . $json["message"] . '"}');
}
}
开发者ID:sembrono,项目名称:1,代码行数:20,代码来源:dx.php
示例10: wz_paseurl
function wz_paseurl($linkurl, $config)
{
$html = get_curl($linkurl, '', $config['cookie']);
$html = str_replace(array("\r", "\n"), '', $html);
$html = str_replace(array("</a>", "</A>"), "</a>\n", $html);
preg_match_all('/<a([^>]*)>([^\\/a>].*)<\\/a>/i', $html, $out);
$out[1] = array_unique($out[1]);
$out[2] = array_unique($out[2]);
$data = array();
foreach ($out[1] as $k => $v) {
if (preg_match('/href=[\'"]?([^\'" ]*)[\'"]?/i', $v, $match_out)) {
if ($config['url_include']) {
if (strpos($match_out[1], $config['url_include']) === false) {
continue;
}
}
if ($config['url_uninclude']) {
if (strpos($match_out[1], $config['url_uninclude']) !== false) {
continue;
}
}
$url2 = $match_out[1];
$url2 = fillurl($url2, $linkurl, $config);
preg_match('/title=[\'"]?([^\'" ]*)[\'"]?/i', $v, $match_out2);
$title = strip_tags($match_out2[1]);
if ($title == '') {
continue;
}
$data[$k]['url'] = $url2;
$data[$k]['title'] = $title;
} else {
continue;
}
}
return $data;
}
开发者ID:another3000,项目名称:wuzhicms,代码行数:36,代码来源:collect_url.php
示例11: header
}
return $hash & 0x7fffffff;
//计算g_tk
}
header("Content-type: text/html; charset=utf-8");
$uin = $_POST["uin"];
//$sid = $_POST["sid"];
$skey = $_POST["skey"];
$touin = $_POST["touin"];
if (!$uin || !$skey || !$touin) {
exit;
}
$gtk = getGTK($skey);
$cookie = 'uin=o0' . $uin . '; skey=' . $skey . ';';
$ua = 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.152 Safari/537.36';
$url = 'http://w.qzone.qq.com/cgi-bin/tfriend/friend_delete_qqfriend.cgi?g_tk=' . $gtk;
$post = 'uin=' . $uin . '&fupdate=1&num=1&fuin=' . $touin . '&qzreferrer=http://user.qzone.qq.com/' . $uin . '/myhome/friends';
$data = get_curl($url, $post, 0, $cookie, 0, $ua);
preg_match('/callback\\((.*?)\\)\\;/is', $data, $json);
$arr = json_decode($json[1], true);
if (@array_key_exists('code', $arr) && $arr['code'] == 0) {
if ($arr['data']['ret'] == 0) {
exit('{"code":0}');
} else {
exit('{"code":-2,"msg":"' . $arr["message"] . '"}');
}
} elseif ($arr['code'] == -3000) {
exit('{"code":-1,"msg":"SKEY已过期!"}');
} else {
exit('{"code":-2,"msg":"' . $arr["message"] . '"}');
}
开发者ID:sembrono,项目名称:1,代码行数:31,代码来源:del.php
示例12: curl_init
if (function_exists('curl_init')) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$output = curl_exec($ch);
echo curl_error($ch);
curl_close($ch);
return $output;
} else {
return file_get_contents($url);
}
}
$response = get_curl($api);
$images = array();
if ($response) {
foreach (json_decode($response)->data as $item) {
$id = $item->id;
$src = $item->images->standard_resolution->url;
$thumb = $item->images->thumbnail->url;
$url = $item->link;
$caption = $item->caption->text;
$user = $item->user;
$createdAt = $item->created_time;
$images[] = array("id" => $id, "src" => htmlspecialchars($src), "thumb" => htmlspecialchars($thumb), "url" => htmlspecialchars($url), "caption" => htmlspecialchars($caption), "user" => $user, "createdAt" => intval($createdAt), "platform" => "instagram");
}
}
print_r(str_replace('\\/', '/', json_encode($images)));
//print_r($response);
开发者ID:eluleci,项目名称:gamzekalpemir,代码行数:31,代码来源:instagramSearch.php
示例13: get_ip_city
function get_ip_city($ip)
{
$url = 'http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=json&ip=';
@($city = get_curl($url . $ip));
$city = json_decode($city, true);
if ($city['city']) {
$location = $city['province'] . $city['city'];
} else {
$location = $city['province'];
}
if ($location) {
return $location;
} else {
return false;
}
}
开发者ID:sembrono,项目名称:1,代码行数:16,代码来源:function.php
示例14: die
}
die("nada");
} else {
//link de watch
$pos = strpos($text, 'sDownloadLink":"');
if ($pos !== false) {
$text = substr($text, $pos + 16);
$pos = strpos($text, '"');
if ($pos !== false) {
$fin = strpos($text, '"', $pos);
$text = substr($text, 0, $fin);
$status = get_curl($text . "?exists=create&container=flv");
if (strpos($status, "<state>true") < 1) {
sleep(2);
$status = get_curl($text . "?exists=create&container=flv");
if (strpos(get_curl($text . "?exists=create&container=flv"), "<state>true") < 1) {
die('{"error":"Try later please","status","' . $status . '"}');
}
}
$text = $text . "?container=flv";
$text = '[{"url":"http://4.bp.blogspot.com/-csh-pGuVtOU/Um6LUwFsKMI/AAAAAAAAAOM/UoBgOWhutGA/s1600/background.png","height":215,"width":512,"type":"image/gif","medium":"image"},{"url":"' . $text . '","height":358,"width":854,"type":"application/x-shockwave-flash","medium":"video"}]';
if ($mf_cache) {
apc_store($mf_cache_key, $text, 900);
}
if ($is_vi) {
apc_store($cache_key, $text, 3600);
}
die($text);
}
}
die;
开发者ID:samirios1,项目名称:niter,代码行数:31,代码来源:mf.php
示例15: showmsg
$row = $DB->get_row("SELECT * FROM wjob_qq WHERE qq='{$qq}' limit 1");
if ($row['lx'] != $gl && $isadmin == 0) {
showmsg('你只能操作自己的QQ哦!');
exit;
}
if ($row['status2'] != 1) {
showmsg('SKEY已过期!');
exit;
}
$sid = $row['sid'];
$skey = $row['skey'];
$gtk = getGTK($skey);
$cookie = "uin=o0" . $qq . "; skey=" . $skey . ";";
$url = 'http://m.qzone.com/friend/mfriend_list?res_uin=' . $qq . '&res_type=normal&format=json&count_per_page=10&page_index=0&page_type=0&mayknowuin=&qqmailstat=&sid=' . $sid;
//$url='http://rc.qzone.qq.com/p/r/cgi-bin/tfriend/friend_show_qqfriends.cgi?uin='.$qq.'&follow_flag=0&groupface_flag=0&fupdate=1&format=json&g_tk='.$gtk;
$json = get_curl($url);
$json = mb_convert_encoding($json, "UTF-8", "UTF-8");
$arr = json_decode($json, true);
//print_r($arr);exit;
if (!$arr) {
showmsg('好友列表获取失败!');
exit;
} elseif ($arr["code"] == -3000) {
showmsg('SID已过期!');
exit;
}
$arr = $arr["data"]["list"];
?>
<script>
$(document).ready(function() {
$('#startcheck').click(function(){
开发者ID:sembrono,项目名称:1,代码行数:31,代码来源:dx.php
示例16: curl_setopt
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
}
if ($header) {
curl_setopt($ch, CURLOPT_HEADER, true);
}
if ($cookie) {
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
}
if ($referer) {
curl_setopt($ch, CURLOPT_REFERER, $referer);
}
if ($ua) {
curl_setopt($ch, CURLOPT_USERAGENT, $ua);
} else {
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Linux; U; Android 4.0.4; es-mx; HTC_One_X Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0");
}
if ($nobaody) {
curl_setopt($ch, CURLOPT_NOBODY, 1);
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$ret = curl_exec($ch);
curl_close($ch);
return $ret;
}
$qun = isset($_GET['qun']) ? $_GET['qun'] : '326026548';
$data = get_curl('http://shang.qq.com/wpa/g_wpa_get?guin=' . $qun . '&t=' . time(), 0, 'http://qun.qq.com/join.html');
$arr = json_decode($data, true);
$idkey = $arr['result']['data'][0]['key'];
$url = 'http://shang.qq.com/wpa/qunwpa?idkey=' . $idkey;
header("Location:{$url}");
exit;
开发者ID:sembrono,项目名称:1,代码行数:31,代码来源:joingroup.php
示例17: get_curl
?>
<table class="table table-bordered table-striped">
<thead>
<tr>
<td colspan="2">查询结果:</td>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2"><div class="alerte alert-error">QQ必须为数字</div></td>
</tr>
</tbody>
</table>
<?php
} else {
$url = get_curl("http://qzone-music.qq.com/fcg-bin/cgi_playlist_xml.fcg?json=1&uin=" . $_GET['qq'] . "&g_tk=5381");
//$url = mb_convert_encoding($url, "UTF-8", "GB2312");
//echo $url;exit;
//preg_match_all('@{xqusic_id\:.*xsong_name\:\"(.*)\".*qqmusic.qq.com/(.*)\'@Ui',$url,$arr);
preg_match_all('@xsong_name\\:\\"(.*)\\"@Ui', $url, $arr);
preg_match_all('@xqusic_id:(.*),xctype:(.*),xexpire_time@Ui', $url, $xqusic);
preg_match_all('@xsong_url\\:\'(.*)\'@Ui', $url, $arrurl);
preg_match_all('@xsinger_name\\:\\"(.*)\\"@Ui', $url, $singger);
//print_r($arr);exit;
$n = count($arr[1]);
?>
<table class="table table-bordered table-striped">
<thead>
<tr>
<td colspan="2"><?php
echo $_GET['qq'];
开发者ID:sembrono,项目名称:1,代码行数:31,代码来源:qzmusic.php
示例18: array_reverse
}
}
if ($sort_ascending) {
$array = array_reverse($temp_array);
} else {
$array = $temp_array;
}
}
function get_curl($url)
{
if (function_exists('curl_init')) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$output = curl_exec($ch);
echo curl_error($ch);
curl_close($ch);
return $output;
} else {
return file_get_contents($url);
}
}
$instagramResponse = json_decode(get_curl($instagramApi), true);
$twitterResponse = json_decode(get_curl($twitterApi), true);
$result = array_merge($instagramResponse, $twitterResponse);
sksort($result, "createdAt");
print_r(json_encode($result));
die;
开发者ID:eluleci,项目名称:gamzekalpemir,代码行数:31,代码来源:search.php
示例19: getCountryForIpJson2
function getCountryForIpJson2($ip = null){
// http://freegeoip.net/xml/89.162.209.186
if (!isset($ip)){
$ip = $_SERVER['REMOTE_ADDR'];
}
$countryCode = false;
$url = 'http://freegeoip.net/json/'.$ip;
if ($content = get_curl($url)){
$params = json_decode($content);
if ($params->country_code){
$countryCode = strtoupper($params->country_code);
}
}else{
$countryCode = getCountryForIpJson($ip);
}
return $countryCode;
}
开发者ID:rjon76,项目名称:netspotapp,代码行数:17,代码来源:index.php
示例20: get_curl
echo '<hr/>';
if ($res['code'] == 1) {
if (!class_exists('ZipArchive') || ini_get('acl.app_id') || defined("SAE_ACCESSKEY")) {
echo '您的空间不支持自动更新,请手动下载更新包并覆盖到程序根目录!<br/>
更新包下载:<a href="' . $res['file'] . '" class="btn btn-primary">update.zip</a>';
} else {
echo '<a href="index.php?mod=update&act=do" class="btn btn-primary btn-block">立即更新到最新版本</a>';
}
echo '<hr/><div class="well">' . $res['uplog'] . '</div>';
}
break;
case 'do':
if (isset($_GET['test'])) {
$checkurl = 'http://cron.aliapp.com/api/check.php?test=true&ver=' . VERSION;
}
$res = get_curl($checkurl);
$res = json_decode($res, true);
$RemoteFile = $res['file'];
$ZipFile = "Archive.zip";
copy($RemoteFile, $ZipFile) or die("无法下载更新包文件!" . '<a href="index.php?mod=update">返回上级</a>');
if (zipExtract($ZipFile, ROOT)) {
echo "程序更新成功!<br>";
echo '<a href="./">返回首页</a>';
unlink($ZipFile);
} else {
echo "无法解压文件!<br>";
echo '<a href="index.php?mod=update">返回上级</a>';
if (file_exists($ZipFile)) {
unlink($ZipFile);
}
}
开发者ID:sembrono,项目名称:mz,代码行数:31,代码来源:update.php
注:本文中的get_curl函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论