I'm using CURL to scrape some website and I would like to insert Jquery file so I did:
$curl_scraped_page = preg_replace("/<*>/i", "<head><script src='https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js' />", $curl_scraped_page, 1);
This seems to work, the script is added to the page which is being extracted and echoed. The problem is that some websites don't function properly anymore. I think because the Jquery script is causing a conflict with other scripts in the page. I think it would help if I put the Jquery at the bottom of head or body tag instead of the top. How do I do this? Al I can think of is:
$curl_scraped_page = preg_replace("/<*>/i", "</head><script src='https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js' />", $curl_scraped_page, 1);
But this has same effect as previous code.