Search the Community
Showing results for tags 'php copy'.
-
Hello, I have 100 of html pages locally stored in a spefic format. I am trying to extract a line from that html pages using php. I can able to search the string and i can able to determine whether the search string is found or not. so far i achieved is <?php $url = 'mylocalpage.html'; $searchstring= 'itemtype'; $contents = file_get_contents($url); if(strpos($contents, $searchstring)!== false) { echo 'Item found'; } else { echo 'Item not found'; } ?> _____________________ Example mylocalpage.html <html> <body> <script> var itemtype = "Mobile"; </script> . . . ..... </body> </html> The next step i need is if it is found i need to copy the entire line from that page. That is if itemtype found I need to copy the entire line that is (var itemtype = "Mobile";) any help appreciated !
-
Why do I get error on move or copy? <?php $user = "joe";mkdir("members/$user", 0777);$srcfile='images/we.png'; $dstfile='members/$user/we.png'; $moveResult = move_uploaded_file($srcfile, $dstfile); if ($moveResult != true) {echo 'failed';exit();}//copy($srcfile, $dstfile) or die("Unable to copy $srcfile to $dstfile."); echo $srcfile, $dstfile, '?/'; ?>