nadeemshafi9 Posted June 5, 2009 Share Posted June 5, 2009 why does this not work ?? $string = 'value="eNrNmGvTosiSgP9Kx5yPnhnuChP2G1HFXQVB7nzjJhdBUNBCfv2idve829ERO3M +7K4RhkValZVZlflUUmu7uGaZYGXJ7Zp9rLWs76M8+1KmX3/TYyJdZukRp5NkmbFHKmKzVczSaZYw8YqOCYpYJsvlCv/tY22AQ9a /Rr1a/2ToPbv2ZXv+IP7A/yDX2PfH2ZRrUkTn4WMdJReo6h80yeEkvca+Pa6b7KoKH84WJ5Yszi0JGRo4scbe4jX213jj9mz1s3tjmX4gHFVUF05twLnZwGYY2SwXPXYTH +rXNfbssU6jIfsgcZzDlzjzhWD+pLk/cXaNveTr7qkONO1t1k3g+Br7LFjP63jNzsnjgyWXa+zH0zobu/aczT1mH3+019hftnXR+QP /9FnhFDXrnqVr2/9YD2Xz2abl0yZydvclX/dDNNz6j2CNfWutk+h+/wAAQECbuYTmFtiaKg988P7Mvr66rLOk/MCZ2aj59zUK1Hl7LYeieZr63wVr7GkK9trjj7VV5ud5smv2ZWzqc //1t2IYuj8xDCH0B6L+aK85NhuMYziHzR3Svsz/9dt7VJaq52P7j4bx0bk9l0lUl1M0zAGiZUPRpl9+2PYrNfbhqYnADiL/+6zq94Sgz78 /JThFMLNO7NdKP3n2d2b52dhrH/3eFxHxnOAnRR/rQ3bMnhGRfXEO6tff/vWP00Uo86wf/hO7vtv0WcN3fW5U37KPjXhjC7jflIJr8ov9Xo7oBA84KSHFr9 /HvXuusR+OfPPyvaWflu7d0fO7u1GWWz4MHit/jFJNlJSFYwjYhX7o0O0qDJ0eyLuLG6re6mxIe+wV0MdhszwuhAf0iIWbMO1iZXIJNXpZJVXtGJEiVTmdqVDKSWFbbgI0q9SGLByk84J3NDrd50yRIH0kjGiSpH18BU7wuA92P2paepRPKzglq +tyVTdWV/uL8VJp6Oun7frm5TZ7vL3yGZwToiF6t6xbXGXJoEdz6vH6Vze7lscyS+HDLfsojq7d80s9F/3cEfj931/2z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4JddXYhHyXul3uG4EioK +/qpixv64qsB/XF39dbLwuRl93vM/LvM93v/8FSe009w=="'; if(eregi("value", $string)){ echo "found"; } else if(eregi("value", urldecode($string))){ echo "found"; } thanks be aware that the $string is cut and paste from FIREBUG so the /'s may mean somthing thanks Quote Link to comment https://forums.phpfreaks.com/topic/161081-ereg-not-working/ Share on other sites More sharing options...
Maq Posted June 5, 2009 Share Posted June 5, 2009 It does work... Why do you think it doesn't? Only 1 found prints out because you have an elseif... Quote Link to comment https://forums.phpfreaks.com/topic/161081-ereg-not-working/#findComment-850043 Share on other sites More sharing options...
nadeemshafi9 Posted June 5, 2009 Author Share Posted June 5, 2009 what happens is that when i post stuff to the server using cURL it responds with a HTML doc and then i extract the values from the hidden input fields. now this value in particular is the problem in more than one instance, as it is generated i doubt it changes in teh session but it somtimes passes the check and somtimes dosent ? eg somtimes completly breaks anything even a substr() and then it dosent go into teh array. here is a sample of what i am doing but let me warn you the server that recives the result on teh other end to whom i post this to says the data is CORUPTED all i am doing is reciving it and sending it on. my algorithm works in step one me to CCPA server and then from CCPA server to me and then from ME to the correct poayer authentication visa thingy then the vis thingy gives me a form in a html doc rember i am sending the codes they give me and everything is flowing nicley i get teh form split it up and present it in my window wrapped in a form and action tags extracted from teh message. PROBLEM i submit the form with it i have to submit like in other steps 3 or 4 variables that came from the server itself, this one in particular in prior steps FALLS somtimes somtimes it goes into place somtimes it dosent eg somtimes ereg('value', blah) detects it somtime it doisent. but in that case it somtimes does go throgh eg every 4 atempts. in this case it goes throgh but the server on teh other end says its corupted data. this is the last step aswell ): our networks are firewalled against any internet access without purchase so they cant use the normal IFRAME METHOD i have to do everything throgh cURL Quote Link to comment https://forums.phpfreaks.com/topic/161081-ereg-not-working/#findComment-850061 Share on other sites More sharing options...
nadeemshafi9 Posted June 5, 2009 Author Share Posted June 5, 2009 look at this public function submitpasformAction(){ $actionURL = "https://83.231.137.172/barclays/tdsecure/pa.jsp"; $keyvalpairs = ""; $hsbc = new Hsbc(); foreach($this->getRequest()->getParams() as $k => $v){ $keyvalpairs .= "&{$k}={$v}"; } $result = $hsbc->pasRequestX($actionURL, $keyvalpairs); // match all HTML tags ************************************** preg_match_all("/<\/?\w+((\s+\w+(\s*=\s*(?:\".*?\\\"|.*?|[^\">\s]+))?)+\s*|\s*)\/?>/s", $result, $matches); // Get the action URL of the form *************************** $formtags = ""; foreach($matches[0] as $k => $v){ if(ereg("<form", $v)){ $formtags .= $v; } } preg_match_all("/action=\"*.*?\"/i", $formtags, $url); @$action = $url[0][0]; $action = ereg_replace("action=", "", $action); $actionURL = ereg_replace("\"", "", $action); ///////////////// unset($matches); preg_match_all("#<input(?:\s+[^>]+)?>#si", $result, $matches); $input_feilds = $matches[0]; $keyvalpairs = ""; //print_r($matches); foreach($input_feilds as $k => $v){ preg_match_all('#([^\s=]+)\s*=\s*(\'[^<\']*\'|"[^<"]*"|"(.*)")#', $v, $matches); // match all xml attributes $name = ""; $value = ""; foreach($matches[0] as $matches_k => $matches_v){ $o=substr($matches_v, 0, 5); if(ereg("name", $matches_v) || ereg("id", $matches_v)){ if(ereg("name", $matches_v)){ $kvpairs[$k]['name'] = ereg_replace("\"", "", $matches_v); $kvpairs[$k]['name'] = ereg_replace("name=", "", $kvpairs[$k]['name']); } } else if($o == "value"){ $kvpairs[$k]['value'] = ereg_replace("\"", "", $matches_v); $kvpairs[$k]['value'] = ereg_replace("value=", "", $kvpairs[$k]['value']); } } } //print_r($kvpairs); foreach($kvpairs as $k => $v){ if($k != 2){ $keyvalpairs .= "&{$v['name']}={$v['value']}"; } } //$keyvalpairs = stripslashes($keyvalpairs); //$keyvalpairs = urldecode($keyvalpairs); $result = $hsbc->pasRequestX('https://www.ccpa.hsbc.com:443/ccpa', $keyvalpairs."&ResultUrl=https://secure.isrighthere.net/api/purchase/getdetails"); echo $keyvalpairs; echo $result; exit; $responseArray['id'] = "purchase result"; $responseArray['success'] = "true"; $responseArray['msg'] = $result; $dojoData = new Zend_Dojo_Data(); $dojoData->setIdentifier('id') ->setMetadata($responseArray); echo $dojoData->toJson(); exit; } Quote Link to comment https://forums.phpfreaks.com/topic/161081-ereg-not-working/#findComment-850067 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.