dougu4704 2014-06-29 07:33
浏览 35

PHP curl没有发布异常字段

I'm trying to use curl to post to this site and I'm not even getting the page to come up.. the fields aren't as straight forward as having a name and a value and the form has an onsubmit. The address and action of the form also seem to change each time the page is reloaded and so the number following the "e" in the address increases by 1 each time..

$url = "http://www.canadapost.ca/cpotools/apps/track/personal/findByRefNumber?execution=e14s1"
$parms = array(
            'tapByTrackSearch:refSearch:refNumbers' => $refnumber,
            'tapByTrackSearch:refSearch:ref_submit_button' => '',
            'tapByTrackSearch:refSearch_SUBMIT' => 1,
            'javax.faces.ViewState' => 'v1Dxx9hSieZwMVPzZZHAPSkIfrSZM1jbO4mNTTN2U0GpxoAFjzFhwFOL94NDwf6uXDCuuM24L5YMuqNSqP+dRYKpGsqhkV+2Tm+y5O2kdGF/NCNJRzUyCzDzaoELlvqQ/L5LRDJEnbwOXh1YOjylrA==',
                ); 

I loop the $parms array later and is passed as $new_fields string.

    $res    =   curl_init();
$config =   
array(
      CURLOPT_URL   =>  $this->url,
      CURLOPT_POST =>   TRUE,
      CURLOPT_POSTFIELDS => $new_fields,
      CURLOPT_RETURNTRANSFER => TRUE,
      CURLOPT_FOLLOWLOCATION => TRUE
    );

curl_setopt_array($res,$config);
$result = curl_exec($res);
curl_close($res);
echo $result;

the output of new fields:

tapByTrackSearch:refSearch:refNumbers=#12484&tapByTrackSearch:refSearch:ref_submit_button=&tapByTrackSearch:refSearch_SUBMIT=1&javax.faces.ViewState=v1Dxx9hSieZwMVPzZZHAPSkIfrSZM1jbO4mNTTN2U0GpxoAFjzFhwFOL94NDwf6uXDCuuM24L5YMuqNSqP+dRYKpGsqhkV+2Tm+y5O2kdGF/NCNJRzUyCzDzaoELlvqQ/L5LRDJEnbwOXh1YOjylrA==&

My code has worked fine with other sites but for some reason I am either entering the fields and their values wrong or the url?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Vue3 大型图片数据拖动排序
    • ¥15 划分vlan后不通了
    • ¥15 GDI处理通道视频时总是带有白色锯齿
    • ¥20 用雷电模拟器安装百达屋apk一直闪退
    • ¥15 算能科技20240506咨询(拒绝大模型回答)
    • ¥15 自适应 AR 模型 参数估计Matlab程序
    • ¥100 角动量包络面如何用MATLAB绘制
    • ¥15 merge函数占用内存过大
    • ¥15 使用EMD去噪处理RML2016数据集时候的原理
    • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大