The PHP code written on Mac can be executed normally, but cannot be matched when running on WebServer. PHPVersion5.5.30 on Mac and PHPVersion5.6.15 on CentOS7 server. The user is not found when the second if is executed! {Code...} is PHP version not... PHP code written on Mac can be executed normally, but it will not match when running on Web Server.
On Mac, PHP Version 5.5.30 and CentOS 7 servers are PHP Version 5.6.15.
The user is not found when the second if is executed!
// The user information on the regular expression matching page, if the match succeeds, go to the editing page if ($ c = preg_match_all ('/(\/UserManage \/edit \/id \/\ d *)/is', $ search_result, $ matches) {$ string1 = $ matches [1] [0]; // obtain the user information on the page and enter the Edit page $ match_user = curl_init (); curl_setopt ($ match_user, CURLOPT_URL ,' https://crm.pzoom.com '. $ String1); // The page on which to obtain information after login curl_setopt ($ match_user, CURLOPT_POST, 1); curl_setopt ($ match_user, CURLOPT_COOKIEFILE, PZOOM_COOKIE_FILE ); // obtain the COOKIE file curl_setopt ($ match_user, CURLOPT_RETURNTRANSFER, 1); // set whether the returned data automatically displays curl_setopt ($ match_user, CURLOPT_HEADER, false ); // set whether to display the header information curl_setopt ($ match_user, CURLOPT_NOBODY, false); // set whether to output the page content $ edit_info = curl_exec ($ match_user ); // returned result curl_close ($ match _ User); // close if ($ c2 = preg_match_all ('/(.*? Value = \ "(. *) \")/is ', $ edit_info, $ edit_info_match) {if ($ c3 = preg_match_all ('/(.*? Value = \ "(. *) \") (checked)/is ', $ edit_info, $ match_radio) {} else {echo "matching failed! ";} If ($ c4 = preg_match_all ('/(textarea class =" descript_cont "name =" user \ [userDesc \] "id =" userDesc "> )(. *) (<\/textarea>)/is ', $ edit_info, $ match_textarea) {} else {echo "matching failed! ";}$ Call_id = $ edit_info_match [2] [0]; $ user_userid = $ edit_info_match [2] [1]; $ user_name = $ edit_info_match [2] [2]; $ user_sex = $ match_radiop [1] [0]; $ user_tel = $ edit_info_match [2] [5]; $ user_mobile = $ edit_info_match [2] [6]; $ user_mail = $ edit_info_match [2] [7]; $ user_departmentid = $ edit_info_match [2] [9]; $ user_address = $ edit_info_match [2] [10]; $ call_areacode = $ edit_info_match [2] [12]; $ call_pwd = $ edit_info_match [2] [14]; $ user_desc = $ match_textarea [2] [0]; $ user_id = substr ($ string1,-4); // initiate a new request and submit the extension code $ edit_userinfor = curl_init (); curl_setopt ($ edit_userinfor, CURLOPT_URL,' https://crm.pzoom.com /UserManage/edit'); // The page on which to obtain information after login curl_setopt ($ edit_userinfor, CURLOPT_POST, 1 ); $ submit_userinfo = "call [id2] = $ call_id & user [userid] = $ user_userid & user [username] = $ user_name & user [sex] = $ user_sex & user [usertel] = $ user_tel & user [usermobile] = $ user_mobile & user [useremail] = $ user_mail & user [Login mentid] = $ user_login mentid & user [address] = $ user_address & call [cno] = $ tel_number & call [areaCode] = 021 & isManager = 1 & call [pwd] = Aa123456 & user [userDesc] = $ user_desc & user [num] = 1 & user [id] = $ user_id "; curl_setopt ($ edit_userinfor, CURLOPT_POSTFIELDS, $ submit_userinfo ); // pass data curl_setopt ($ edit_userinfor, CURLOPT_COOKIEFILE, PZOOM_COOKIE_FILE); // obtain the COOKIE file curl_setopt ($ edit_userinfor, CURLOPT_RETURNTRANSFER, 1 ); // set whether the returned data will automatically display curl_setopt ($ edit_userinfor, CURLOPT_HEADER, false); // set whether to display the header information $ submint_userinfo = curl_exec ($ edit_u Serinfor); // returned result curl_close ($ edit_userinfor); // close} else {die ("This user is not found! ") ;}} Else {die (" This user is not found! ");}}
Does the regular expression vary with PHP versions?
Reply content:
The PHP code written on Mac can be executed normally, but cannot be matched when running on the Web Server.
On Mac, PHP Version 5.5.30 and CentOS 7 servers are PHP Version 5.6.15.
The user is not found when the second if is executed!
// The user information on the regular expression matching page, if the match succeeds, go to the editing page if ($ c = preg_match_all ('/(\/UserManage \/edit \/id \/\ d *)/is', $ search_result, $ matches) {$ string1 = $ matches [1] [0]; // obtain the user information on the page and enter the Edit page $ match_user = curl_init (); curl_setopt ($ match_user, CURLOPT_URL ,' https://crm.pzoom.com '. $ String1); // The page on which to obtain information after login curl_setopt ($ match_user, CURLOPT_POST, 1); curl_setopt ($ match_user, CURLOPT_COOKIEFILE, PZOOM_COOKIE_FILE ); // obtain the COOKIE file curl_setopt ($ match_user, CURLOPT_RETURNTRANSFER, 1); // set whether the returned data automatically displays curl_setopt ($ match_user, CURLOPT_HEADER, false ); // set whether to display the header information curl_setopt ($ match_user, CURLOPT_NOBODY, false); // set whether to output the page content $ edit_info = curl_exec ($ match_user ); // returned result curl_close ($ match _ User); // close if ($ c2 = preg_match_all ('/(.*? Value = \ "(. *) \")/is ', $ edit_info, $ edit_info_match) {if ($ c3 = preg_match_all ('/(.*? Value = \ "(. *) \") (checked)/is ', $ edit_info, $ match_radio) {} else {echo "matching failed! ";} If ($ c4 = preg_match_all ('/(textarea class =" descript_cont "name =" user \ [userDesc \] "id =" userDesc "> )(. *) (<\/textarea>)/is ', $ edit_info, $ match_textarea) {} else {echo "matching failed! ";}$ Call_id = $ edit_info_match [2] [0]; $ user_userid = $ edit_info_match [2] [1]; $ user_name = $ edit_info_match [2] [2]; $ user_sex = $ match_radiop [1] [0]; $ user_tel = $ edit_info_match [2] [5]; $ user_mobile = $ edit_info_match [2] [6]; $ user_mail = $ edit_info_match [2] [7]; $ user_departmentid = $ edit_info_match [2] [9]; $ user_address = $ edit_info_match [2] [10]; $ call_areacode = $ edit_info_match [2] [12]; $ call_pwd = $ edit_info_match [2] [14]; $ user_desc = $ match_textarea [2] [0]; $ user_id = substr ($ string1,-4); // initiate a new request and submit the extension code $ edit_userinfor = curl_init (); curl_setopt ($ edit_userinfor, CURLOPT_URL,' https://crm.pzoom.com /UserManage/edit'); // The page on which to obtain information after login curl_setopt ($ edit_userinfor, CURLOPT_POST, 1 ); $ submit_userinfo = "call [id2] = $ call_id & user [userid] = $ user_userid & user [username] = $ user_name & user [sex] = $ user_sex & user [usertel] = $ user_tel & user [usermobile] = $ user_mobile & user [useremail] = $ user_mail & user [Login mentid] = $ user_login mentid & user [address] = $ user_address & call [cno] = $ tel_number & call [areaCode] = 021 & isManager = 1 & call [pwd] = Aa123456 & user [userDesc] = $ user_desc & user [num] = 1 & user [id] = $ user_id "; curl_setopt ($ edit_userinfor, CURLOPT_POSTFIELDS, $ submit_userinfo ); // pass data curl_setopt ($ edit_userinfor, CURLOPT_COOKIEFILE, PZOOM_COOKIE_FILE); // obtain the COOKIE file curl_setopt ($ edit_userinfor, CURLOPT_RETURNTRANSFER, 1 ); // set whether the returned data will automatically display curl_setopt ($ edit_userinfor, CURLOPT_HEADER, false); // set whether to display the header information $ submint_userinfo = curl_exec ($ edit_u Serinfor); // returned result curl_close ($ edit_userinfor); // close} else {die ("This user is not found! ") ;}} Else {die (" This user is not found! ");}}
Does the regular expression vary with PHP versions?
Let's test the data. Let's just see what it means.
Because the company's OA system is captured, it is not convenient to disclose all the code. After matching, I want to connect to the local database for data matching and fill in the corresponding values!
The following is the form of the page to be matched: