dou91808 2012-11-01 10:23
浏览 31
已采纳

从skrill服务器获取SESSION_ID

Please help me i am having some trouble. What i want to do is integrate moneybooker in my website. I studied the "Merchant Integration Manual version 6.17" in 2.3.2 Topic where i have to create and get a SESSION_ID form skrill server by sending payment parameters by post and get the SESSION_ID this session will hold my transaction information like amount and my account.

By using below code i can't retrieve the SESSION_ID from their server.

$url = "https:www.moneybookers.com/app/payment.pl";

$post_data = array (  
        "prepare_only" => 1,  
        "amount" => 10,
        "currency" => 'USD',
        "detail1_description" => "Description",
        "detail1_text" => "Text",
        "pay_to_email" => "****my**accoutn@yahoo.com" 
    );  


$head = get_web_page($url, $post_data);
echo "<pre>";
print_r($head);
echo "</pre>";



function get_web_page( $url, $post_data )
{
    $options = array(
        CURLOPT_RETURNTRANSFER => true,     // return web page
        CURLOPT_HEADER         => false,    // don't return headers
        CURLOPT_FOLLOWLOCATION => true,     // follow redirects
        CURLOPT_ENCODING       => "",       // handle all encodings
        CURLOPT_USERAGENT      => "spider", // who am i
        CURLOPT_AUTOREFERER    => true,     // set referer on redirect
        CURLOPT_CONNECTTIMEOUT => 120,      // timeout on connect
        CURLOPT_TIMEOUT        => 120,      // timeout on response
        CURLOPT_MAXREDIRS      => 10,       // stop after 10 redirects
    );

    $ch      = curl_init( $url );
    curl_setopt_array( $ch, $options );
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     //we are doing a POST request  
    curl_setopt($ch, CURLOPT_POST, 1);  
     //adding the post variables to the request  
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
    $content = curl_exec( $ch );
    $err     = curl_errno( $ch );
    $errmsg  = curl_error( $ch );
    $header  = curl_getinfo( $ch );
    curl_close( $ch );

    $header['errno']   = $err;
    $header['errmsg']  = $errmsg;
    $header['content'] = $content;
    return $header;
}

The above code works for other sites but not for moneybooker. But when i submit simple html form, session id is created and shown but i am not being redirected to my site !!

  • 写回答

2条回答 默认 最新

  • doufen3563 2012-11-01 10:52
    关注

    Try adding cookies support

    $fh = fopen("cookies.txt", "a+") or die("Can't open file!");
    fclose($fh);
    
    $ch = curl_init();
    
    
    
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt");
    curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt");
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥30 vmware exsi重置后的密码
  • ¥15 易盾点选的cb参数怎么解啊
  • ¥15 MATLAB运行显示错误,如何解决?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
  • ¥20 yolov5自定义Prune报错,如何解决?
  • ¥15 电磁场的matlab仿真
  • ¥15 mars2d在vue3中的引入问题
  • ¥50 h5唤醒支付宝并跳转至向小荷包转账界面