本文整理汇总了PHP中get_curl函数的典型用法代码示例。如果您正苦于以下问题:PHP get_curl函数的具体用法?PHP get_curl怎么用?PHP get_curl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_curl函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
示例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;
}
}
示例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];
}
}
示例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'];
}
示例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;
}
示例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 '离线';
}
}
示例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;
}
示例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"] . '"}');
}
}
示例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"] . '"}');
}
}
示例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;
}
示例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"] . '"}');
}
示例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);
示例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;
}
}
示例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;
示例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(){