$jsonData, 'apiMethod' => $method ]); $auth = md5(implode(':', [ $appkey, $appSecurity, 3000, $jsonData ])); $headers = [ "appkey:{$appkey}", 'Content-Type:application/x-www-form-urlencoded', "Authorization:{$auth}", 'timestamp:3000' ]; $url = 'https://ssotest.lrlz.com/lrlz-auth/remote/router'; $server_output = http_post_data($url, $post_data, $headers); $server_output = json_decode($server_output, 1); $obj = '$150$RdVJUoG50MmyXtz2eww9jA==$1$'; $this->assertEquals($server_output['render']['obj'], $obj); } // // public function testFtp() // { // $ftp_server = 'dc.lrlz.com'; // $ftp_user_name = 'appftp'; // $ftp_user_pass = 'wdSe92md*'; // // $conn_id = ftp_connect($ftp_server); // $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass) or die("Failed"); // // if ((!$conn_id) || (!$login_result)) { // check connection // // wont ever hit this, b/c of the die call on ftp_login // echo "FTP connection has failed!
"; // echo "Attempted to connect to $ftp_server for user $ftp_user_name"; // exit; // } // // $remote_file = "./20190108/json_trade-20190108040100.txt"; // $local_file = basename($remote_file); // $fields = explode(',', 'tid,num,num_iid,status,title,type,price,seller_cod_fee,discount_fee,point_fee,has_post_fee,total_fee,is_lgtype,is_brand_sale,is_force_wlb,lg_aging,lg_aging_type,created,pay_time,modified,end_time,buyer_message,alipay_id,alipay_no,alipay_url,buyer_memo,buyer_flag,seller_memo,seller_flag,invoice_name,buyer_nick,buyer_area,buyer_email,has_yfx,yfx_fee,yfx_id,yfx_type,has_buyer_message,area_id,credit_card_fee,nut_feature,step_trade_status,step_paid_fee,mark_desc,eticket_ext,send_time,shipping_type,buyer_cod_fee,express_agency_fee,adjust_fee,buyer_obtain_point_fee,cod_fee,trade_from,alipay_warn_msg,cod_status,can_rate,commission_fee,trade_memo,buyer_rate,trade_source,seller_can_rate,is_part_consign,is_daixiao,real_point_fee,receiver_city,receiver_district,is_wt,seller_nick,iid,pic_path,payment,snapshot_url,snapshot,seller_rate,post_fee,buyer_alipay_no,receiver_name,receiver_state,receiver_address,receiver_zip,receiver_mobile,receiver_phone,consign_time,seller_alipay_no,seller_mobile,seller_phone,seller_name,seller_email,available_confirm_fee,received_payment,timeout_action_time,is_3D,promotion,etl_created,etl_modifyed,order_size,shop_id,encrypt_alipay_id'); // var_dump($fields); // ftp_get($conn_id, $local_file, $remote_file, FTP_BINARY); // // // $file = fopen($local_file, "r"); // 以只读的方式打开文件 // // $i = 0; // ////输出文本中所有的行,直到文件结束为止。 // while (!feof($file)) { // $itemStr = fgets($file); //fgets()函数从文件指针中读取一行 // $itemArray = explode("\t", $itemStr); // 将tab分割的各部分内容提取出来 // foreach ($itemArray as $key => $value) { // if ($fields[$key]) { // $new_itemArray[$fields[$key]] = $value; // } // } // $i++; // } // // // $this->assertEquals(1, $i); // } }