php - cURL removing form data on submit? -
i have code submit form, working , adding "test" in textarea , saving fine. form has checkboxes on (that checked already) , these beingness cleared when submits?
can help?
my code far (messy know i've been trying sorts!)
<? //$post_data['cmd'] = 'status'; $post_data['oordernum'] = '191111'; //order number //post_data['act'] = 'load'; //load order number $post_data['oswhpass'] = 'on'; //checkbox $post_data['osintnote'] = 'test'; //internal note $post_data['act'] = 'save'; //save order //traverse array , prepare info posting (key1=value1) foreach ( $post_data $key => $value) { $post_items[] = $key . '=' . $value; } //create final string posted using implode() $post_string = implode ('&', $post_items); //username , password of business relationship $username = 'xxxxxx'; $password = 'xxxxxx'; $loginurl = 'https://www.xxxxxx.co.uk/xxxxxx/?cmd=login'; //init curl $ch = curl_init(); //set url work curl_setopt($ch, curlopt_url, $loginurl); // enable http post curl_setopt($ch, curlopt_post, 1); //set post parameters curl_setopt($ch, curlopt_postfields, 'u='.$username.'&p='.$password); //handle cookies login curl_setopt($ch, curlopt_cookiejar, 'cookie.txt'); curl_setopt($ch, curlopt_returntransfer, 1); //execute request (the login) $store = curl_exec($ch); //the login done , can go on //protected content. //set url protected file curl_setopt($ch, curlopt_url, 'https://www.xxxxxx.co.uk/xxxxxx/sales/default.asp?cmd=status'); curl_setopt($ch, curlopt_postfields, $post_string); //execute request $content = curl_exec($ch); //show info regarding request print_r(curl_getinfo($ch)); echo curl_errno($ch) . '-' . curl_error($ch); curl_close($ch); ?>
php curl
No comments:
Post a Comment