php - Send POST with cURL postfields to iframe -


i trying send post data using curl url. url called iframe, in application.

<iframe frameborder="0" width="950" height="1000" src="/tools/costs"></iframe>       public function costs() {         $url = "http://someurl.com/tools/costs";               if($_post)             {                 $fields_str = http_build_query($_post);                  $query = preg_replace('/%5b[0-9]+%5d/simu', '%5b%5d',$fields_str);                 $realstring = str_replace("%5d", "", str_replace("%5b", "", $query));                  // $realstring echo:                 var_carrier=3&var_carrier=5&var_carrier=6&var_service=demurrage+%2f+storage&var_service=detention&var_pod=ancona&var_pod=antalya&var_pod=antwerpen                  $ch = curl_init();                 curl_setopt($ch, curlopt_header, 0);                 curl_setopt($ch, curlopt_returntransfer, 1);                 curl_setopt($ch, curlopt_post, 1);                 curl_setopt($ch, curlopt_postfields,$realstring);                 curl_setopt($ch, curlopt_followlocation, 1);                 curl_setopt($ch, curlopt_url, $url);                 $response = curl_exec($ch);                 curl_close($ch);             }             else             {                 $ch = curl_init();                 curl_setopt($ch, curlopt_header, 0);                 curl_setopt($ch, curlopt_returntransfer, 1);                 curl_setopt($ch, curlopt_followlocation, 1);                 curl_setopt($ch, curlopt_url, $url);                 $response = curl_exec($ch);                 curl_close($ch);                 $fields_str = "";             }     echo  $response; } 

but $realstring variable empty when send curl postfields have no idea wy!


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -