Jump to content

yhi

Members
  • Content Count

    53
  • Joined

  • Last visited

Community Reputation

0 Neutral

About yhi

  • Rank
    Regular Member
  1. i am using php to generate some stuff & using javascript to insert those stuff in my firebase DB but now the problem is some of those generated strings contain some html anchor tag in them so my JS script is refusing them & they are not getting inserted because they contain single quote i tried to replace single quote with double quote but then firebase is adding a backslash before every " so those anchor tags are not working when i am showing DB on a page so far i was only able to think about one solution that i should remove all single & double quote & href will still work & i can replace space with %20 so the link will not get broke example generated string by my php hello <a href='https://forums.phpfreaks.com'>PHP freaks</a> my JS script [API keys] firebase.initializeApp(config); var database = firebase.database(); var ref = database.ref('phpfreaks'); var data = { text: '$text1', text2: '$text2' } ref.push(data); PS i cant remove single quote before my variable in JS script if i do so the data will not get entered...
  2. yhi

    execution fast

    no they are removing my script i tried to contact support team but till now there is no reply from their side i tried something i am breaking my script into 2 parts & ya i also think the problem is causing because my script is running to frequently i will play around with time of execution & i dont think its resource issue.. but just to be sure are we supposed to use some sort of flush function after file_get_html or file_get_contents ?
  3. yhi

    execution fast

    i am only scrapping data from one website, webpage size is ~ 400kb i am running script after every 120 seconds (2 min) is there any way to do it more efficiently ?
  4. yhi

    execution fast

    yes i am using code to calculate execution time $executionStartTime = microtime(true); //at top of script $executionEndTime = microtime(true); //last lines $seconds = $executionEndTime - $executionStartTime; //Print it out echo "This script took $seconds to execute."; and i posted it like that because i want to know if any of my syntax is causing any slow down... i check it it taking 1-2.xx seconds in execution what should or can i do ?
  5. yhi

    execution fast

    i coded a scrapper for a web page i added the scrapper to cron jobs of my free web hosting account my hosting account is continuously removing the script maybe because it is taking more than 5 seconds for execution i tried to run it manually & recorded the time it only took 1-2 seconds in execution but IDK maybe sometime that webpage response is slow & thats why it is taking that much time i want to make my script fast please help me my script look like this $html=file_get_html("https://www.website.com"); identify div with id strip_tags("$text","<a>"); str_replace // i am replacing some junk like &nbsp etc, i am using str_replace 5 times htmlspecialchars // so that it dosent cause any sql error when i save scrapped stuff in db $sql = "INSERT INTO abc(sfdf, contedfnt) VALUES ('$dfdf', '$text')"; if ($conn->query($sql) === TRUE) { echo "Added"; } else { echo "Error: " . $conn->error; } what can i do to make my code execute fast ?
  6. yhi

    reading and performing action

    it seems line base64_decode(); is the one causing problem i tried a few sites to decrypt the 8kb string manually i only received a partial output how to fix it ?
  7. yhi

    reading and performing action

    ok but what about the size limit ? each line is 8kb but i am only receiving 2.97ks in output what could be the problem ?
  8. yhi

    reading and performing action

    <?php $handle = fopen("data.txt", "r"); if ($handle) { while (($line = fgets($handle)) !== false) { $current=base64_decode($line); $file=rand(); file_put_contents($file, $current); echo"done"; } fclose($handle); } else { echo"error opening the file."; } ?> i wrote this script but in my output file i only got 2.97kb data data.txt have 8kb data in each line
  9. i want my php script to read a local file ~56mb (1000+ lines) and perform a operation on each of the lines separately i am not sure how to do this i have no clue how to properly read file can i use file_get _contents( ) ? and after reading how to perform the operation on each lines separately can i use forreach ? PS it it makes ant difference those 1000+ lines are base64encoded lines and i want to decrypt them each line seprately
  10. yhi

    auto html comments

    sorry i am not good in english do i didnt know i am being rude sorry
  11. yhi

    auto html comments

    seems fair here <?php $comment=" blah blah"; foreach ($files as $file){ $code=file_get_contents("$file"); $finalcode="$comment$code"; $writefile = fopen("$file","w"); echo fwrite($writefile,"$finalcode"); fclose($file); } ?> i am not sure how to read read all files name in all directories
  12. yhi

    auto html comments

    i want to add comments in JS & PHP files there are 22K files so i cant do it manually i need a php script which i can run & it should add my comment in all files please give me a script which will add my comment in top line of all PHP and Js file i can run script separately for php & JS PS please make sure script dont change anything else on those php& JS source code thanks for the help
  13. yhi

    share buttons

    want to do it for FB ,twitter & google+
  14. yhi

    share buttons

    i need help in creating share button for my mobile website traditional share button when clicked share out URL or content using web browsers but i want them to share via app.. i mean when user click on fb icon it should promote fb application with content to share. currently it is opening fb website in browser and user have to login to FB website to share
  15. yhi

    mysql error

    m not totally sure what you are saying can you please explain or post the query thanks
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.