Skip to content

scrape data using regex and simplehtmldom

i am trying to scrape some data from this site : http://laperuanavegana.wordpress.com/ . actually i want the title of recipe and ingredients . ingredients is located inside two specific keyword . i am trying to get this data using regex and simplehtmldom . but its showing the full html text not just the ingre…

php str_replace replacing itself

I need to replace every occurrence of one of the letters a,o,i,e,u with [aoieu]? I tried to do the following: But when giving it input of black instead of giving me the expected bl[aoieu]?ck it gave me How can I get it to not replace things it already replaced? Answer You can consider using a regular expressi…

PHP encapsulation without class?

Is it possible to encapsulate, a variable or function let say, in PHP without wrapping them in a class? What I was doing is: My intention is to avoid naming conflict. This routine, although it works, makes me tired. If I cannot do it without class, it is possible not to instantiate a class? and just use the v…

hash in JS == hash in PHP

I need to make a hash with JS and PHP but I need them to both work out to be the same hash. I am just wondering what the best idea would be to go about it. it needs to be secure, but its not hashing …

How to optimize a query with MySQL multi-query?

I need to optimize a script for high performance so the question is how can I add MySQL multi-query to this code? Answer If you’re using mysqli or PDO already, you should be using prepared statements for your queries since they are supported. This will also have a slight increase in performance since th…

Handwritten text recognition php

I am thinking of creating a certain web system. It involves a lot of different (random) people uploading scanned documents of stuff they wrote. Is there any PHP open source way converting these handwritten texts to machine text? I found this question but would like to know if it is capable of recognizing a lo…

Sending Javascript Object to PHP via Ajax

I’m learning Ajax by failure and have hit a wall: I have an array (if it matters, the array is storing number id’s based on what checkboxes the user checks) that is written in Javascript. I have a function that is called when the user clicks the ‘save’ button. The function is as follow…