doulu4316 2014-07-28 08:32
浏览 71
已采纳

通过php函数中的表单动作在url中传递参数

I am using web services to get the parameter from SOAP client successfully. I want to pass this parameters in url through html form so that i can connect to my system with this parameters. I have 2 functions. Function login() is to set the parameters for the connection from SOAP client and function getVehicle() to get this parameters. In getVehicle() i want to send the parameters user, hash password, dealer_number, corporate_group_id to client.php from url. And this parameters i want to send from form action without submit button.

index.php

    function login()
    {
        $wsdl = 'http://www.schwackenet.de/awonline/de/service2/SNWebService.php?wsdl';
        $options = array('trace' => true);

        $params = array(
          'user' =>               utf8_encode('deshmukh'),
          'password' =>           utf8_encode('deshmukh'),
          'corporate_group_id' => '101',
          'dealer_number' =>      'INT31303',
          'dms_id' =>             'A13T2D19',
          'dms_image_url' =>      '', 
          'dms_keepalive_url' =>  '', 
          'dms_followup_url' =>   ''  
        );

        $client = new SoapClient($wsdl, $options);  
        $result = $client->Login($params);      
        return $return;
    }

if($parameter['aktion'] == 'getVehicle') 
{       
    //var_dump(Login());
    $vehicle=login();
    $user_login=$vehicle['user'];
    $password=$vehicle['password'];
    $dealer_no=$vehicle['dealer_number'];
    $group_id=$vehicle['corporate_group_id'];

//form action here         

    }
  • 写回答

2条回答 默认 最新

  • dongtuoao7987 2014-07-28 09:02
    关注

    You can have the data transferred to your client.php as a GET request using the built-in php function file_get_contents() like this:

    if ($parameter['aktion'] == 'getVehicle') 
    {       
        $vehicle=login();
        $user_login=$vehicle['user'];
        $password=$vehicle['password'];
        $dealer_no=$vehicle['dealer_number'];
        $group_id=$vehicle['corporate_group_id'];
    
        // send the data to your system
        $system_url = 'http://yoursite.com/path/to/client.php';
        header("Location: $system_url?user=$user_login&password=$password&dealer_number=$dealer_no&corporate_group_id=$group_id");
        exit();
    }
    

    If you want, you can have client.php reurn a "success" or "error" output and you'll have it on the $response variable and you can log it or do something else with it.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 写论文,需要数据支撑
  • ¥15 identifier of an instance of 类 was altered from xx to xx错误
  • ¥100 反编译微信小游戏求指导
  • ¥15 docker模式webrtc-streamer 无法播放公网rtsp
  • ¥15 学不会递归,理解不了汉诺塔参数变化
  • ¥15 基于图神经网络的COVID-19药物筛选研究
  • ¥30 软件自定义无线电该怎样使用
  • ¥15 R语言mediation包做中介分析,直接效应和间接效应都很小,为什么?
  • ¥15 Jenkins+k8s部署slave节点offline
  • ¥15 如何实现从tello无人机上获取实时传输的视频流,然后将获取的视频通过yolov5进行检测