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


PHP OAuthUtil::boundary方法代码示例

本文整理汇总了PHP中OAuthUtil::boundary方法的典型用法代码示例。如果您正苦于以下问题:PHP OAuthUtil::boundary方法的具体用法?PHP OAuthUtil::boundary怎么用?PHP OAuthUtil::boundary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OAuthUtil的用法示例。


在下文中一共展示了OAuthUtil::boundary方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: build_http_query_multi

 public static function build_http_query_multi($params)
 {
     if (!$params) {
         return '';
     }
     //print_r( $params );
     //return null;
     // Urlencode both keys and values
     $keys = array_keys($params);
     $values = array_values($params);
     //$keys = OAuthUtil::urlencode_rfc3986(array_keys($params));
     //$values = OAuthUtil::urlencode_rfc3986(array_values($params));
     $params = array_combine($keys, $values);
     // Parameters are sorted by name, using lexicographical byte value ordering.
     // Ref: Spec: 9.1.1 (1)
     uksort($params, 'strcmp');
     $pairs = array();
     self::$boundary = $boundary = uniqid('------------------');
     $MPboundary = '--' . $boundary;
     $endMPboundary = $MPboundary . '--';
     $multipartbody = '';
     foreach ($params as $parameter => $value) {
         //if( $parameter == 'pic' && $value{0} == '@' )
         if (in_array($parameter, array("pic", "image"))) {
             /*
             $tmp = 'E:\qweibo_proj\trunk\1.txt';
             $url = ltrim($tmp,'@');
             $content = file_get_contents( $url );
             $filename = reset( explode( '?' , basename( $url ) ));
             $mime = self::get_image_mime($url); 
             */
             //$url = ltrim( $value , '@' );
             $content = $value[2];
             //file_get_contents( $url );
             $filename = $value[1];
             //reset( explode( '?' , basename( $url ) ));
             $mime = $value[0];
             //self::get_image_mime($url);
             $multipartbody .= $MPboundary . "\r\n";
             $multipartbody .= 'Content-Disposition: form-data; name="' . $parameter . '"; filename="' . $filename . '"' . "\r\n";
             $multipartbody .= 'Content-Type: ' . $mime . "\r\n\r\n";
             $multipartbody .= $content . "\r\n";
         } else {
             $multipartbody .= $MPboundary . "\r\n";
             $multipartbody .= 'Content-Disposition: form-data; name="' . $parameter . "\"\r\n\r\n";
             $multipartbody .= $value . "\r\n";
         }
     }
     $multipartbody .= "{$endMPboundary}\r\n";
     // For each parameter, the name is separated from the corresponding value by an '=' character (ASCII code 61)
     // Each name-value pair is separated by an '&' character (ASCII code 38)
     return $multipartbody;
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:53,代码来源:oauth.php

示例2: build_http_query_multi

 public static function build_http_query_multi($params)
 {
     if (!$params) {
         return '';
     }
     // Urlencode both keys and values
     $keys = array_keys($params);
     $values = array_values($params);
     $params = array_combine($keys, $values);
     // Parameters are sorted by name, using lexicographical byte value ordering.
     // Ref: Spec: 9.1.1 (1)
     uksort($params, 'strcmp');
     $pairs = array();
     self::$boundary = $boundary = uniqid('------------------');
     $MPboundary = '--' . $boundary;
     $endMPboundary = $MPboundary . '--';
     $multipartbody = '';
     foreach ($params as $parameter => $value) {
         if (in_array($parameter, array("pic", "image")) && $value[0] == '@') {
             $url = ltrim($value, '@');
             $content = file_get_contents($url);
             $filename = reset(explode('?', basename($url)));
             $mime = self::get_image_mime($url);
             $multipartbody .= $MPboundary . "\r\n";
             $multipartbody .= 'Content-Disposition: form-data; name="' . $parameter . '"; filename="' . $filename . '"' . "\r\n";
             $multipartbody .= 'Content-Type: ' . $mime . "\r\n\r\n";
             $multipartbody .= $content . "\r\n";
         } else {
             $multipartbody .= $MPboundary . "\r\n";
             $multipartbody .= 'content-disposition: form-data; name="' . $parameter . "\"\r\n\r\n";
             $multipartbody .= $value . "\r\n";
         }
     }
     $multipartbody .= $endMPboundary;
     // For each parameter, the name is separated from the corresponding value by an '=' character (ASCII code 61)
     // Each name-value pair is separated by an '&' character (ASCII code 38)
     // echo $multipartbody;
     return $multipartbody;
 }
开发者ID:Git-Host,项目名称:gdxkc-code,代码行数:39,代码来源:oauth_lib.class.php

示例3: build_http_query_multi

 public static function build_http_query_multi($params)
 {
     if (!$params) {
         return '';
     }
     //print_r( $params );
     //return null;
     // Urlencode both keys and values
     $keys = array_keys($params);
     $values = array_values($params);
     //$keys = OAuthUtil::urlencode_rfc3986(array_keys($params));
     //$values = OAuthUtil::urlencode_rfc3986(array_values($params));
     $params = array_combine($keys, $values);
     // Parameters are sorted by name, using lexicographical byte value ordering.
     // Ref: Spec: 9.1.1 (1)
     uksort($params, 'strcmp');
     $pairs = array();
     self::$boundary = $boundary = uniqid('------------------');
     $MPboundary = '--' . $boundary;
     $endMPboundary = $MPboundary . '--';
     $multipartbody = '';
     foreach ($params as $parameter => $value) {
         //if( $parameter == 'pic' && $value{0} == '@' )
         if (in_array($parameter, array("pic", "image"))) {
             $content = $value;
             $filename = 'pic.jpg';
             $mime = 'image/jpeg';
             $multipartbody .= $MPboundary . "\r\n";
             $multipartbody .= 'Content-Disposition: form-data; name="' . $parameter . '"; filename="' . $filename . '"' . "\r\n";
             $multipartbody .= 'Content-Type: ' . $mime . "\r\n\r\n";
             $multipartbody .= $content . "\r\n";
         } else {
             $multipartbody .= $MPboundary . "\r\n";
             $multipartbody .= 'content-disposition: form-data; name="' . $parameter . "\"\r\n\r\n";
             $multipartbody .= $value . "\r\n";
         }
     }
     $multipartbody .= $endMPboundary . "\r\n";
     // For each parameter, the name is separated from the corresponding value by an '=' character (ASCII code 61)
     // Each name-value pair is separated by an '&' character (ASCII code 38)
     // echo $multipartbody;
     return $multipartbody;
 }
开发者ID:BGCX262,项目名称:zuituware-svn-to-git,代码行数:43,代码来源:txwboauth.php

示例4: build_http_query_multi

 public static function build_http_query_multi($params)
 {
     if (!$params) {
         return '';
     }
     //print_r( $params );
     //return NULL;
     // Urlencode both keys and values
     $keys = array_keys($params);
     $values = array_values($params);
     //$keys = OAuthUtil::urlencode_rfc3986(array_keys($params));
     //$values = OAuthUtil::urlencode_rfc3986(array_values($params));
     $params = array_combine($keys, $values);
     // Parameters are sorted by name, using lexicographical byte value ordering.
     // Ref: Spec: 9.1.1 (1)
     uksort($params, 'strcmp');
     $pairs = array();
     self::$boundary = $boundary = uniqid('------------------');
     $MPboundary = '--' . $boundary;
     $endMPboundary = $MPboundary . '--';
     $multipartbody = '';
     foreach ($params as $parameter => $value) {
         if (in_array($parameter, array('pic', 'image')) && $value[0] == '@') {
             $url = ltrim($value, '@');
             $content = file_get_contents($url);
             $array = explode('?', basename($url));
             $filename = $array[0];
             $mime = self::get_image_mime($url);
             $multipartbody .= $MPboundary . "\r\n";
             $multipartbody .= 'Content-Disposition: form-data; name="' . $parameter . '"; filename="' . $filename . '"' . "\r\n";
             $multipartbody .= 'Content-Type: ' . $mime . "\r\n\r\n";
             $multipartbody .= $content . "\r\n";
         } else {
             $multipartbody .= $MPboundary . "\r\n";
             $multipartbody .= 'content-disposition: form-data; name="' . $parameter . "\"\r\n\r\n";
             $multipartbody .= $value . "\r\n";
         }
         /*
                     if (is_array($value)) {
                         // If two or more parameters share the same name, they are sorted by their value
                         // Ref: Spec: 9.1.1 (1)
                         natsort($value);
                         foreach ($value as $duplicate_value) {
                             $pairs[] = $parameter . '=' . $duplicate_value;
                         }
                     } else {
                         $pairs[] = $parameter . '=' . $value;
                     }*/
     }
     $multipartbody .= $endMPboundary;
     // For each parameter, the name is separated from the corresponding value by an '=' character (ASCII code 61)
     // Each name-value pair is separated by an '&' character (ASCII code 38)
     // echo $multipartbody;
     return $multipartbody;
 }
开发者ID:xiaodin1,项目名称:myqee,代码行数:55,代码来源:saet.class.php

示例5: build_http_query_multi

 public static function build_http_query_multi($params)
 {
     if (!$params) {
         return '';
     }
     $keys = array_keys($params);
     $values = array_values($params);
     $params = array_combine($keys, $values);
     uksort($params, 'strcmp');
     $pairs = array();
     self::$boundary = $boundary = uniqid('------------------');
     $MPboundary = '--' . $boundary;
     $endMPboundary = $MPboundary . '--';
     $multipartbody = '';
     foreach ($params as $parameter => $value) {
         if (in_array($parameter, array("pic", "image"))) {
             if (is_array($value)) {
                 $content = $value[2];
                 $filename = $value[1];
                 $mime = $value[0];
             } elseif ($value[0] == '@') {
                 $url = ltrim($value, '@');
                 $content = file_get_contents($url);
                 $filename = reset(explode('?', basename($url)));
                 $mime = self::get_image_mime($url);
             }
             $multipartbody .= $MPboundary . "\r\n";
             $multipartbody .= 'Content-Disposition: form-data; name="' . $parameter . '"; filename="' . $filename . '"' . "\r\n";
             $multipartbody .= 'Content-Type: ' . $mime . "\r\n\r\n";
             $multipartbody .= $content . "\r\n";
         } else {
             $multipartbody .= $MPboundary . "\r\n";
             $multipartbody .= 'Content-Disposition: form-data; name="' . $parameter . "\"\r\n\r\n";
             $multipartbody .= $value . "\r\n";
         }
     }
     $multipartbody .= "{$endMPboundary}\r\n";
     return $multipartbody;
 }
开发者ID:lyhiving,项目名称:mini_class,代码行数:39,代码来源:OAuth.php

示例6: build_http_query_multi

 public static function build_http_query_multi($params)
 {
     if (!$params) {
         return '';
     }
     //print_r( $params );
     //return null;
     // Urlencode both keys and values
     $keys = array_keys($params);
     $values = array_values($params);
     //$keys = OAuthUtil::urlencode_rfc3986(array_keys($params));
     //$values = OAuthUtil::urlencode_rfc3986(array_values($params));
     $params = array_combine($keys, $values);
     // Parameters are sorted by name, using lexicographical byte value ordering.
     // Ref: Spec: 9.1.1 (1)
     uksort($params, 'strcmp');
     $pairs = array();
     self::$boundary = $GLOBALS['__CLASS']['OAuthRequest']['__STATIC']['boundary'] = $boundary = uniqid('------------------');
     $MPboundary = '--' . $boundary;
     $endMPboundary = $MPboundary . '--';
     $multipartbody = '';
     foreach ($params as $parameter => $value) {
         if ($parameter == 'pic' || $parameter == 'image') {
             if (is_string($value) && $value[0] == '@') {
                 $url = ltrim($value, '@');
                 //��ʱ����
                 $ctx_userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 3.5.30729)';
                 if (version_compare(PHP_VERSION, '5.0.0', '>=')) {
                     $ctx_header = "Accept: *" . "/" . "*\r\nAccept-Language: zh-cn\r\nUser-Agent: {$ctx_userAgent}\r\n";
                     $ctx = stream_context_create(array('http' => array('timeout' => 8, 'method' => 'GET', 'header' => $ctx_header)));
                     $content = file_get_contents($url, 0, $ctx);
                 } else {
                     @ini_set('user_agent', $ctx_userAgent);
                     $content = file_get_contents($url);
                 }
                 $filename = reset(explode('?', basename($url)));
                 $mime = OAuthUtil::get_image_mime($url);
             } elseif (is_array($value)) {
                 $content = $value[2];
                 //file_get_contents( $url );
                 $filename = $value[1];
                 //reset( explode( '?' , basename( $url ) ));
                 $mime = $value[0];
                 //self::get_image_mime($url);
             }
             $multipartbody .= $MPboundary . "\r\n";
             $multipartbody .= 'Content-Disposition: form-data; name="' . $parameter . '"; filename="' . $filename . '"' . "\r\n";
             $multipartbody .= 'Content-Type: ' . $mime . "\r\n\r\n";
             $multipartbody .= $content . "\r\n";
         } else {
             $multipartbody .= $MPboundary . "\r\n";
             $multipartbody .= 'Content-Disposition: form-data; name="' . $parameter . "\"\r\n\r\n";
             $multipartbody .= $value . "\r\n";
         }
     }
     $multipartbody .= "{$endMPboundary}\r\n";
     // For each parameter, the name is separated from the corresponding value by an '=' character (ASCII code 61)
     // Each name-value pair is separated by an '&' character (ASCII code 38)
     // echo $multipartbody;
     return $multipartbody;
 }
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:61,代码来源:oauth.class.php


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