2014-10-22 51 views
0

我無法將值發佈到字段並處理進一步的步驟來下載文件。任何人都可以提出我要去哪裏?登錄後通過php curl程序處理網頁

extract($_POST); 
     $url=header("Location: http://gis.lntecc.com/bwssblnt/Scada.aspx? field1=Kathriguppe%2cSW2DM0402%2c235505H073%2c450"); 
    $fields =array(
      "TextBoxFromDate" => urlencode("2014-10-01"), 
      "TextBoxToDate" => urlencode("2014-10-09") 
      ); 

    foreach($fields as $key => $value) 

    $fields_string .= $key.'='.$value.'&'; 

    rtrim($fields, '&'); 

    $ch = curl_init(); 

    curl_setopt($ch, CURLOPT_URL, $url); 
    curl_setopt($ch, CURLOPT_POST, count($fields)); 
    curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 

    $result = curl_exec($ch); 
    echo $result; 
    curl_close($ch); 

我在哪裏犯了錯誤,因爲我無法將值發佈到現場?

回答

0

只需刪除那巨大的空間,在你的網址:

$url=header("Location: http://gis.lntecc.com/bwssblnt/Scada.aspx? field1=Kathriguppe%2cSW2DM0402%2c235505H073%2c450"); 

變爲:

$url=header("Location: http://gis.lntecc.com/bwssblnt/Scada.aspx?field1=Kathriguppe%2cSW2DM0402%2c235505H073%2c450");