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 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
  • ¥15 IAR程序莫名变量多重定义
  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题
  • ¥100 已有python代码,要求做成可执行程序,程序设计内容不多
  • ¥15 目标检测项目无法读取视频
  • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
  • ¥100 求采集电商背景音乐的方法
  • ¥15 数学建模竞赛求指导帮助
  • ¥15 STM32控制MAX7219问题求解答