当前位置: 首页>>代码示例>>PHP>>正文


PHP Curl::post方法代码示例

本文整理汇总了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);
 }
开发者ID:php-mod,项目名称:curl,代码行数:9,代码来源:CurlTest.php

示例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;
}
开发者ID:nurulimamnotes,项目名称:Web-Tracking,代码行数:26,代码来源:inc.functions.php

示例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);
 }
开发者ID:houdunwang,项目名称:hdcms,代码行数:7,代码来源:Button.php

示例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);
 }
开发者ID:aslijiasheng,项目名称:jacksonslim,代码行数:7,代码来源:CurlPlugin.class.php

示例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());
 }
开发者ID:chchmlml,项目名称:ceshi,代码行数:26,代码来源:CampaignTest.php

示例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);
 }
开发者ID:Colorado-rom,项目名称:hdphp,代码行数:7,代码来源:CustomService.php

示例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);
 }
开发者ID:OmondiKevin,项目名称:ADT_MTRH,代码行数:29,代码来源:cdrr_logic.php

示例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);
 }
开发者ID:ChenHuaPHP,项目名称:ZOLshop,代码行数:7,代码来源:User.php

示例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;
 }
开发者ID:aslijiasheng,项目名称:jasongo,代码行数:7,代码来源:express_service_model.php

示例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);
 }
开发者ID:Colorado-rom,项目名称:hdphp,代码行数:7,代码来源:Group.php

示例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
 }
开发者ID:npdung,项目名称:Get-link,代码行数:47,代码来源:GetlinkController.php

示例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;
 }
开发者ID:janhenckens,项目名称:wp-connect-strava,代码行数:8,代码来源:class-wp-connect-strava-auth.php

示例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;
 }
开发者ID:mgcxy,项目名称:yiiSwoole,代码行数:8,代码来源:XHttp.php

示例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;
 }
开发者ID:nixusheng,项目名称:33pu,代码行数:17,代码来源:m_oauth.php

示例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;
 }
开发者ID:ice-wolf,项目名称:polyglotcode,代码行数:15,代码来源:flickr.class.php


注:本文中的Curl::post方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。