本文整理汇总了PHP中httpGet函数的典型用法代码示例。如果您正苦于以下问题:PHP httpGet函数的具体用法?PHP httpGet怎么用?PHP httpGet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了httpGet函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pushMenuToRemote
public function pushMenuToRemote($button_list)
{
$this->refreshToken();
//需要先执行删除操作,把现有菜单全部删除
if ($this['agent_id'] > 0) {
$api = config("wechat_api.qy.menu.delete");
$api = sprintf($api, $this['access_token'], $this['agent_id']);
} else {
$api = config("wechat_api.service.menu.delete");
$api = sprintf($api, $this['access_token']);
}
$result = httpGet($api);
if ($this['agent_id'] > 0) {
$api = config("wechat_api.qy.menu.create");
$api = sprintf($api, $this['access_token'], $this['agent_id']);
} else {
$api = config("wechat_api.service.menu.create");
$api = sprintf($api, $this['access_token']);
}
foreach ($button_list as $k => $button) {
$sub_btn_list = [];
if (count($button['sub_button']) > 0) {
foreach ($button['sub_button'] as $i => $child_button) {
$sub_btn_list[] = $button_list[$k]['sub_button'][$i];
}
}
unset($button_list[$k]['sub_button']);
$button_list[$k]['sub_button'] = $sub_btn_list;
}
$result = httpPost($api, json_encode(array("button" => $button_list), JSON_UNESCAPED_UNICODE));
return $result;
//$result = json_decode($result,true);
//return array("button"=>$button_list);
}
示例2: __construct
function __construct($city, $movie = null)
{
// $search = $word;
// if (preg_match("~([\w\s]+) (at|in) ([\w\s]+)~", $word, $matches)) {
// $this->movie = $matches[1];
// $this->near = $matches[3];
// } else {
// $this->near = $word;
// }
$this->near = $city;
$this->movie = $movie;
if ($this->near && $this->movie) {
// $url = "http://www.google.co.in/movies?hl=en&near=" . urlencode($this->near) . "&q=" . urlencode($this->movie);
$url = "http://IP/gwrapper/googlemovies_wrapper.php?near=" . urlencode($this->near) . "&q=" . urlencode($this->movie);
} else {
if ($this->near) {
// $url = "http://www.google.co.in/movies?hl=en&near=" . urlencode($this->near);
$url = "http://IP/gwrapper/googlemovies_wrapper.php?near=" . urlencode($this->near);
}
}
echo $url;
$localmovie_in = httpGet($url);
if ($this->movie) {
$this->return = $this->parse_withMovie($localmovie_in);
} else {
$this->return = $this->parse($localmovie_in);
}
}
示例3: _getAccessToken
private function _getAccessToken()
{
//获取access_token;要进行缓存
$access_token_url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$this->appid}&secret={$this->appsecret}";
$json_return = httpGet($access_token_url);
return $json_return['access_token'];
}
示例4: getsrilankajob
function getsrilankajob($url)
{
echo "<h2> inside job sri lanks</h2>";
$content = httpGet($url);
if (preg_match('~<div class="head">(.+)</div>~Usi', $content, $matched)) {
$title = $matched[1];
$title = trim(preg_replace("~[\\s]+~", " ", $title));
$title = trim(str_replace("</h1>", "***", $title));
$title = trim(str_replace("</h2>", "***", $title));
$title = strip_tags($title);
$title = trim(preg_replace("~[\\s]+~", " ", $title));
$title = trim(str_replace("***", "\n", $title));
$title = trim(str_replace("\n ", "\n", $title));
}
if (preg_match('~<div style="padding: 15px;" class="lightgrey_box">(.+)<span class="clear">~Usi', $content, $matches)) {
$out = $matches[1];
$out = trim(preg_replace("~[\\s]+~", " ", $out));
$out = trim(str_replace("</dd>", "***", $out));
$out = strip_tags($out);
$out = trim(preg_replace("~[\\s]+~", " ", $out));
$out = trim(str_replace("***", "\n", $out));
$out = trim(str_replace("\n ", "\n", $out));
}
if (!empty($title)) {
return $title . "\n" . $out;
} else {
return $out;
}
}
示例5: sendSMS
function sendSMS($to, $message)
{
$username = "shatkonlabs";
$password = "blueteam@11111p";
$senderid = "";
return httpGet("http://www.smsjust.com/blank/sms/user/urlsms.php?" . "username=" . $username . "&pass=" . $password . "&senderid=" . $senderid . "&message=" . $message . "&dest_mobileno=" . $to . "&msgtype=TXT");
}
示例6: getAnswers
function getAnswers()
{
$out = "";
$url = "API";
$response = httpGet($url);
if ($pos1 = strpos($response, 'id="q_answer"')) {
$pos1 += 14;
if ($pos2 = strpos($response, "<!-- google_ad_section_end -->", $pos1)) {
$answer = substr($response, $pos1, $pos2 - $pos1);
$this->answer = trim(strip_tags($answer));
}
} else {
if (($pos1 = strpos($response, "Is one of these your question?", 0)) !== false) {
$pos2 = strpos($response, "No? Post your question to the community!", $pos1);
$sub = substr($response, $pos1, $pos2 - $pos1);
preg_match_all("~<span onclick=[^<]+><img class=[^>]+>([^<]+)</span>(\\s?<span [^>]+>\\|</span>\\s<span [^>]+>(Unanswered)</span>)?~", $sub, $matches);
$i = 1;
foreach ($matches[1] as $key => $match) {
if ($matches[3][$key] == "") {
$sender = $_GET['number'];
$page = mysql_real_escape_string($match);
$query = "INSERT INTO lists (sender,number,page,type) VALUES ('{$sender}',{$i},'{$page}','wikianswers')";
mysql_query($query) or die(mysql_error() . " in {$query}");
$out .= "{$i}. {$match}\n";
$i++;
}
}
if ($out !== "") {
$out = "Is one of these your question? Reply GYAN OPTION (e.g GYAN 1)\n" . $out;
}
$this->answer = trim(strip_tags($out));
}
}
}
示例7: sendProSMS
function sendProSMS($to, $message)
{
$username = "rajnish90";
$password = "redhat123";
$senderid = "BLUETM";
$url = "http://www.smsjust.com/blank/sms/user/urlsms.php?" . "username=" . $username . "&pass=" . $password . "&senderid=" . $senderid . "&dest_mobileno=" . $to . "&msgtype=TXT" . "&message=" . urlencode($message) . "&response=Y";
//echo $url;
return httpGet($url);
}
示例8: __construct
function __construct()
{
echo "<br>India Earnings<br>";
global $word;
echo $url = "http://indiaearnings.moneycontrol.com/sub_india/compsearch_result.php?companyname=" . urlencode($word) . "&fname=price&searchtype=new";
$indiaearnings_in = httpGet($url);
// var_dump($indiaearnings_in);
$this->setCompany($indiaearnings_in);
var_dump($this->company);
var_dump($this->company_code);
}
示例9: getPersonWithProfession
function getPersonWithProfession($profession, $key)
{
$url = "https://api.deutsche-digitale-bibliothek.de/entities?rows=10000&query=professionOrOccupation:" . str_replace("\"", "", json_encode($profession));
$httpResult = httpGet($url, array("Authorization" => "OAuth oauth_consumer_key=\"" . $key . "\""));
$resultJson = json_decode($httpResult);
if (property_exists($resultJson, "results") && count($resultJson->results) > 0 && property_exists($resultJson->results[0], "docs")) {
$results = $resultJson->results[0]->docs;
} else {
$results = array();
}
return $results;
}
示例10: downloadHeadImg
/**
* 下载图像
*/
public function downloadHeadImg()
{
ignore_user_abort(true);
set_time_limit(0);
for ($i = 100; $i > 0; $i++) {
$rt = $this->table('task_headimgdownload')->where(array('status' => 0))->get();
if (!$rt) {
$this->setTimeOut($i);
continue;
}
$tempPath = '../TempImg/';
$path = 'img/headImg/';
foreach ($rt as $a) {
//先验证是否已更换图片
$user = $this->table('user')->where(array('id' => $a['user_id']))->get(array('photo'), true);
if ($user['photo'] != $a['photo']) {
$status = 3;
} else {
$img = httpGet($a['photo']);
$fileName = time() . rand(10000, 99999) . '.jpg';
$save = file_put_contents($tempPath . $fileName, $img);
if ($save) {
$uploadStatus = true;
$image = new \System\lib\Image\Image($tempPath . $fileName);
$fileName2 = str_replace('.jpg', '_150.jpg', $fileName);
$image->thumb(200, 10000)->save($tempPath . $fileName2);
$status = 1;
//上传到图片服务器
$upload = httpPost($this->config('IMG_UPLOAD'), ['file' => new \CURLFile(realpath($tempPath . $fileName)), 'savePath' => $path, 'saveName' => basename($tempPath . $fileName)], true);
$upload = json_decode($upload, true);
if (!($upload && $upload['result'] == true)) {
$uploadStatus = false;
}
//上传压缩图
$upload2 = httpPost($this->config('IMG_UPLOAD'), ['file' => new \CURLFile(realpath($tempPath . $fileName2)), 'savePath' => $path, 'saveName' => basename($tempPath . $fileName2)], true);
$upload2 = json_decode($upload, true);
if (!($upload2 && $upload2['result'] == true)) {
$uploadStatus = false;
}
if ($uploadStatus == false) {
$status = 2;
} else {
$up2 = $this->table('user')->where(['id' => $a['user_id']])->update(['photo' => '/', $path . $fileName, 'photo_150' => '/', $path . $fileName2]);
$status = 1;
}
} else {
$status = 2;
}
}
$up = $this->table('task_headimgdownload')->where(['id' => $a['id']])->update(array('status' => $status, 'execute_time' => time()));
}
}
}
示例11: getAnswer
function getAnswer()
{
$content = httpGet($this->url);
if (preg_match("~<div class=\"answer_text\" id=\"editorText\">(.+)</div>~Usi", $content, $match)) {
$WikiAns = trim(strip_tags($match[1]));
$WikiAns = html_entity_decode($WikiAns);
}
if (!empty($WikiAns)) {
$this->output = $WikiAns;
return $this->output;
}
}
示例12: jobdetails
function jobdetails($url)
{
echo $url = "http://kenyanjobs.blogspot.com/" . trim($url);
$content = httpGet($url);
if (preg_match('~<div dir="ltr" style="text-align: left;" trbidi="on">(.+)<div style=\'text-align: center;\'><br/><br/>~Usi', $content, $match)) {
$data = $match[1];
$data = preg_replace('~[\\s]+~', " ", $data);
$data = strip_tags($data);
$this->return["job"] = $data;
} else {
$this->return["job"] = "No data found";
}
}
示例13: getipinfo
function getipinfo()
{
header("Content-Type:text/html; charset=utf-8");
$url = 'http://1111.ip138.com/ic.asp';
//这儿填页面地址
$info = httpGet($url);
$p = "%<center>(.*?)</center>%si";
preg_match_all($p, $info, $arr);
$info = $arr[1];
$str1 = explode("[", iconv('GB2312', 'UTF-8', $info[0]));
$str2 = explode("]", $str1[1]);
$ip = $str2[0] . '_' . substr($str2[1], 10);
return $ip;
}
示例14: getlist
function getlist($url)
{
$content = httpGet($url);
$p = '/<span class=\\"tit\\">(.*?)<\\/span>/is';
preg_match_all($p, $content, $arr);
if ($arr[1]) {
foreach ($arr[1] as $k => $v) {
$pre = trim($v);
$st = explode('title="', $pre);
$st = explode('">', $st[1]);
echo trim($st[0]) . '
';
}
}
}
示例15: runAll
function runAll()
{
global $servers;
file_put_contents('var/locales', json_encode(array_keys($servers)));
foreach ($servers as $locale => $server) {
$account = 'royalAdmin';
$pass = 'royalPass';
if (!empty($server['account'])) {
$account = $server['account'];
$pass = $server['pass'];
}
httpPost($server['login_url'], array('account' => $account, 'password' => $pass, 'submit' => true));
$dashboard = httpGet($server['dashboard_url'], array());
preg_match('/var statisDatas = ([^;]*);/sim', $dashboard, $data);
$dataArray = json_decode($data[1], true);
handleData($locale, $dataArray);
}
}