本文整理汇总了PHP中Curl::post方法的典型用法代码示例。如果您正苦于以下问题:PHP Curl::post方法的具体用法?PHP Curl::post怎么用?PHP Curl::post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Curl
的用法示例。
在下文中一共展示了Curl::post方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testPostFilePathUpload
public function testPostFilePathUpload()
{
$file_path = $this->get_png();
$data = array('key' => 'image', 'image' => '@' . $file_path);
$this->curl->setOpt(CURLOPT_RETURNTRANSFER, true);
$this->curl->post(self::TEST_URL . '/post_file_path_upload.php', $data);
$this->assertEquals(array('request_method' => 'POST', 'key' => 'image', 'mime_content_type' => 'image/png'), json_decode($this->curl->response, true));
unlink($file_path);
}
示例2: fAlamat
function fAlamat($lat = 0, $lon = 0)
{
include_once './curl.class.php';
$curl = new Curl();
// $a = $curl->post('http://ws.geonames.org/extendedFindNearby?lng='.$lon.'&lat='.$lat);
$a = $curl->post('http://maps.google.com/maps/geo?q=' . $lat . ',' . $lon . '&gl=id&output=xml');
/*
$r["negara"] = $a["geonames"]["geoname"][2]["name"];
$r["propinsi"] = $a["geonames"]["geoname"][3]["name"];
$r["kota"] = $a["geonames"]["geoname"][4]["name"];
*/
$r["koordinat"] = $a['kml']['Response']['name'];
$r["alamat"] = $a['kml']['Response']['Placemark']['address'];
$r["negara"] = $a['kml']['Response']['Placemark']['AddressDetails']['Country']['CountryName'];
$r["propinsi"] = $a['kml']['Response']['Placemark']['AddressDetails']['Country']['AdministrativeArea']['AdministrativeAreaName'];
//if (empty($a['kml']['Response']['Placemark']['AddressDetails']['Country']['AdministrativeArea']['SubAdministrativeArea']['SubAdministrativeAreaName'])){
$r["kota"] = $a['kml']['Response']['Placemark']['AddressDetails']['Country']['AdministrativeArea']['SubAdministrativeArea']['Locality']['LocalityName'];
$r["daerah"] = $a['kml']['Response']['Placemark']['AddressDetails']['Country']['AdministrativeArea']['SubAdministrativeArea']['Locality']['DependentLocalityName'];
$r["jalan"] = $a['kml']['Response']['Placemark']['AddressDetails']['Country']['AdministrativeArea']['SubAdministrativeArea']['Locality']['Thoroughfare']['ThoroughfareName'];
//} else {
// $r["kota"] = $a['kml']['Response']['Placemark']['AddressDetails']['Country']['AdministrativeArea']['SubAdministrativeArea']['Locality']['LocalityName'] . "," . $a['kml']['Response']['Placemark'][0]['AddressDetails']['Country']['AdministrativeArea']['SubAdministrativeArea']['SubAdministrativeAreaName'];
// $r["daerah"] = $a['kml']['Response']['Placemark']['AddressDetails']['Country']['AdministrativeArea']['SubAdministrativeArea']['Locality']['DependentLocality']['DependentLocalityName'];
// $r["jalan"] = $a['kml']['Response']['Placemark']['AddressDetails']['Country']['AdministrativeArea']['SubAdministrativeArea']['Locality']['DependentLocality']['Thoroughfare']['ThoroughfareName'];
//}
return $r;
}
示例3: createAddconditionalButton
public function createAddconditionalButton($button)
{
$url = $this->apiUrl . '/cgi-bin/menu/addconditional?access_token=' . $this->getAccessToken();
$content = Curl::post($url, urldecode(json_encode($this->urlencodeArray($button))));
$result = json_decode($content, true);
return $this->get($result);
}
示例4: post
public static function post($path, $data)
{
$curl = new Curl();
$curl->setHeader('Content-Type', 'application/json');
$curl->post(\Slim\Slim::getInstance()->globalConfig['oaUrl'] . $path, $data);
return json_decode($curl->response->json, TRUE);
}
示例5: testStoreDelete
public function testStoreDelete()
{
$data1 = ['name' => time(), 'creative_id' => 60, 'budget' => 500, 'price' => 20, 'start_time' => '2015-08-01 09:40:00', 'end_time' => '2970-01-01 00:00:00', 'fans' => '["1662047260","2977214740"]', 'age[start]' => '8', 'age[end]' => '78', 'gender' => '401', 'location' => '-1', 'device' => '110201', 'network_type[]' => '1204', 'talking_data_url' => 'http://www.baidu.com', 'ge_tui_url' => 'http://www.ba222idu.com', 'customer_id' => 3779606125];
$result = Curl::post('http://local.app.weibo.com/app/campaigns?_is_ajax=1', $data1, [$this->cookies]);
echo $result;
$this->assertEquals(201, Curl::getHttpCode());
//
// $data1 = [
// 'customer_id' => 0,
// '_method' => 'delete'
// ];
//
// $result = Curl::post('http://suchong.fst.weibo.com/creatives/5?_is_ajax=1', $data1, [$this->cookies]);
// $this->assertEquals(200, Curl::getHttpCode());
// echo $result;
//
// $data1 = [
// 'customer_id' => 0,
// '_method' => 'put',
// 'disable_comment' => 0
// ];
//
// $result = Curl::post('http://suchong.fst.weibo.com/creatives/4?_is_ajax=1', $data1, [$this->cookies]);
// echo $result;
// $this->assertEquals(200, Curl::getHttpCode());
}
示例6: send
private function send($toUser, $msgType, $data)
{
$url = $this->apiUrl . '/cgi-bin/message/custom/send?access_token=' . $this->getAccessToken();
$json = json_encode(array('touser' => $toUser, 'msgtype' => $msgType, $msgType => $data));
$result = Curl::post($url, $json);
return $this->get($result);
}
示例7: process_user
public function process_user($username, $password, $facility_code)
{
$curl = new Curl();
$response = array();
//Get Supplier
$supplier = $this->get_supplier($facility_code);
if ($supplier == "kemsa") {
//Use nascop url
$url = $this->default_url;
$post = array("email" => $username, "password" => $password);
$url = $this->default_url . 'sync/user';
$curl->post($url, $post);
} else {
//Use escm url
$curl->setBasicAuthentication($username, $password);
$curl->setOpt(CURLOPT_RETURNTRANSFER, TRUE);
$url = $this->default_url . 'user/' . $username;
$curl->get($url);
}
//Handle Response
if ($curl->error) {
$response['error'] = TRUE;
$response['content'] = array($curl->error_code);
} else {
$response['error'] = FALSE;
$response['content'] = json_decode($curl->response, TRUE);
}
return json_encode($response);
}
示例8: getUserInfoLists
public function getUserInfoLists($param)
{
$url = $this->apiUrl . '/cgi-bin/user/info/batchget?access_token=' . $this->getAccessToken();
$content = Curl::post($url, urldecode(json_encode($this->urlencodeArray($param))));
$result = json_decode($content, true);
return $this->get($result);
}
示例9: expressTakeUp
public function expressTakeUp($userID, $expressID)
{
$curl = new Curl();
$data = array("expressID" => $expressID, "userID" => $userID);
$curl->post($this->url['expressTake'], $data);
return $curl->response;
}
示例10: delGroup
public function delGroup($param)
{
$url = $this->apiUrl . "/cgi-bin/groups/delete?access_token={$this->access_token}";
$content = Curl::post($url, urldecode(json_encode($this->urlencodeArray($param))));
$result = json_decode($content, true);
return $this->get($result);
}
示例11: get_link
public function get_link()
{
// Check Captcha
$response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=6LfXLBwTAAAAAKog-gWVMOmDJKhHGEMCELdR-Ukn&response=" . Input::get('g-recaptcha-response'));
$obj = json_decode($response);
if ($obj->success == false) {
echo 'Captcha error';
exit;
} else {
libxml_use_internal_errors(true);
require_once app_path('Libraries/Curl.php');
$url = Input::get('url');
$url = str_replace("http://", "https://", $url);
// step 1: Login
$curl = new \Curl();
$curl->get('https://www.fshare.vn');
$session_id = $curl->getCookie('session_id');
$doc = new \DOMDocument();
$doc->loadHTML($curl->response);
$xpath = new \DOMXpath($doc);
$array = $xpath->query("//*[@id='login-form']//*[@name='fs_csrf']");
foreach ($array as $value) {
$fs_csrf = $value->getAttribute('value');
}
$curl->setCookie('session_id', $session_id);
$curl->post('https://www.fshare.vn/login', array("fs_csrf" => $fs_csrf, "LoginForm[email]" => "phandung1111059@gmail.com", "LoginForm[password]" => "7508286", "LoginForm[rememberMe]" => "0", "yt0" => "Đăng nhập"));
$session_id = $curl->getCookie('session_id');
$curl->setCookie('session_id', $session_id);
$curl->post('https://www.fshare.vn/login', array("fs_csrf" => $fs_csrf, "LoginForm[email]" => "phandung1111059@gmail.com", "LoginForm[password]" => "7508286", "LoginForm[rememberMe]" => "0", "yt0" => "Đăng nhập"));
echo "Step 1: Login - Done !!! <br>";
// step 2: Get link download
$curl->get($url);
$doc = new \DOMDocument();
$doc->loadHTML($curl->response);
$xpath = new \DOMXpath($doc);
$array = $xpath->query("//*[@id='download-form']/div[1]/input");
foreach ($array as $value) {
$fs_csrf = $value->getAttribute('value');
}
$split_url = explode('/', $url);
$curl->post('https://www.fshare.vn/download/get', array("fs_csrf" => $fs_csrf, "DownloadForm[pwd]" => "", "DownloadForm[linkcode]" => end($split_url), "ajax" => "download-form", "undefined" => "undefined"));
echo "Step 2: Get Link Download - Done !!! <br><br>";
echo "URL: " . @$curl->response->url;
return redirect()->away($curl->response->url);
}
// END IF CHECK RECAPTCHA
}
示例12: postRequest
private function postRequest($url, $fields)
{
$curl = new Curl();
$curl->addHeader('Authorization: Bearer ', $fields['code']);
$curl->addOption(CURLOPT_RETURNTRANSFER, true);
$request = $curl->post($url, $fields);
return $request;
}
示例13: array
static function post_json($url_mixed, $data = array())
{
Yii::import('application.vendors.*');
require_once 'Tp/Curl.class.php';
$curl = new Curl();
$curl->post($url_mixed, $data);
return $curl->response;
}
示例14: Curl
/**
* 获得access_token
*
*/
function get_access_token($code)
{
$this->config->load('oauth_qq');
$curl = new Curl();
$postdata = array('grant_type' => 'authorization_code', 'code' => $code, 'client_id' => $this->config->item('api_key'), 'client_secret' => $this->config->item('api_key_secret'), 'redirect_uri' => $this->config->item('callback_url'), 'state' => '1');
$curl->options['CURLOPT_SSL_VERIFYPEER'] = false;
$response = $curl->post($this->config->item('access_token_url'), $postdata);
preg_match('/^access_token=.*&/', $response, $matches);
$access_token = $matches[0];
$access_token = substr($access_token, 13, -1);
//echo $access_token;
return $access_token;
}
示例15: getAccessToken
private function getAccessToken()
{
$oauth_data = $this->getOAuthParameters();
$oauth_data['oauth_token'] = $_GET['oauth_token'];
$oauth_data['oauth_verifier'] = $_GET['oauth_verifier'];
$access_token_url = 'https://www.flickr.com/services/oauth/access_token';
$oauth_data['oauth_signature'] = $this->getSignature('POST', $access_token_url, $oauth_data);
$curl = new Curl();
$curl->post($access_token_url, $oauth_data);
parse_str($curl->response, $parts);
$_SESSION['oauth_access_token'] = $parts['oauth_token'];
$_SESSION['oauth_access_token_secret'] = $parts['oauth_token_secret'];
$_SESSION['user_id'] = $parts['user_nsid'];
$_SESSION['authenticated'] = true;
}