Need help sanitizing the parsed data
-
I need to sanitize the data fetached using this plugin but I am unable to do it. I’ve tried both the preg_replace and filter_var functions.
$test222=wpws_get_content('https://homeshopping.pk/products/Apple-iPhone-6-Price-in-Pakistan-16gb.html', 'em[itemprop=price]', array( 'output' => 'text', ) ); echo preg_replace('/[^0-9,.]/', '', $test222);
The fetch returns “Rs72,490” which is fine. Now using the preg_replace I want to keep “72,490” only but it outputs an abnormal value like “.616.60.211872,4900.102”.
Whereas, if I give an absolute value to the preg_replace functions instead of the $test222 variable, it works fine. I suspect it could be something that the Wp-Ws attaches with the srapped data.
Any help will be highly appreciated.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Need help sanitizing the parsed data’ is closed to new replies.