RE: [PHP] saving outside website content via php...
-Original Message- From: blackwater dev [mailto:[EMAIL PROTECTED] Sent: Sunday, June 01, 2008 9:26 PM To: Shawn McKenzie Cc: php-general@lists.php.net Subject: Re: [PHP] saving outside website content via php... Yes, but file_get_contents will get me the code which I could then echo back out to the browser but that wouldn't give me any external images, css files or js. Use the RegEx examples for tag-grabbing that appeared in this mailing list last week. Parse whatever text is returned from cURL and find any *.css links, *.js links, *.jpg/gif/png/etc images, and then use cURL once again to download them and save them. I'm sorry if you were hoping for some magic function that will do all of that for you, but there is none. There may very well be some pre-packaged solutions to your problem, but I don't know of any off-hand. Seriously, though: think like a programmer! You can get the text, and the links to the elements you want to save are in the text. Parse it! Parse it for all you're worth! Todd Boyd Web Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] saving outside website content via php...
Boyd, Todd M. wrote: -Original Message- From: blackwater dev [mailto:[EMAIL PROTECTED] Sent: Sunday, June 01, 2008 9:26 PM To: Shawn McKenzie Cc: php-general@lists.php.net Subject: Re: [PHP] saving outside website content via php... Yes, but file_get_contents will get me the code which I could then echo back out to the browser but that wouldn't give me any external images, css files or js. Use the RegEx examples for tag-grabbing that appeared in this mailing list last week. Parse whatever text is returned from cURL and find any *.css links, *.js links, *.jpg/gif/png/etc images, and then use cURL once again to download them and save them. I'm sorry if you were hoping for some magic function that will do all of that for you, but there is none. There may very well be some pre-packaged solutions to your problem, but I don't know of any off-hand. Seriously, though: think like a programmer! You can get the text, and the links to the elements you want to save are in the text. Parse it! Parse it for all you're worth! Todd Boyd Web Programmer That is one way if you're using all PHP. If you have access to wget (most linux), then you can do it in one shell command. 'wget --convert-links -r http://www.example.com/' will get all files recursively, save them and convert the links to point to the local files. Also look at the --mirror option. Lot's of options/possibilities with wget. There are bound to be some PHP classes that wrap wget somewhere. -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] saving outside website content via php...
why no just save the searhed url in a db field. next time you just need call the iframe with the last or N search anyway if you still want to save all the searched page try using curl http://ar.php.net/manual/en/function.curl-exec.php saludos On Sat, May 31, 2008 at 8:11 PM, blackwater dev [EMAIL PROTECTED] wrote: I'm using the google api to allow people to search the web via my site. The pages are simply iframed within my site. Is it possible for me to give them a 'save' button and let them save the page they are viewing in it's current state? I don't mean save to their computer but I would use php to save it to disk or the db. How can I do this and pull in all the css, images, etc? Thanks! -- Los sabios buscan la sabidurĂa; los necios creen haberla encontrado. Gabriel Sosa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] saving outside website content via php...
Gabriel Sosa wrote: why no just save the searhed url in a db field. next time you just need call the iframe with the last or N search anyway if you still want to save all the searched page try using curl http://ar.php.net/manual/en/function.curl-exec.php saludos On Sat, May 31, 2008 at 8:11 PM, blackwater dev [EMAIL PROTECTED] wrote: I'm using the google api to allow people to search the web via my site. The pages are simply iframed within my site. Is it possible for me to give them a 'save' button and let them save the page they are viewing in it's current state? I don't mean save to their computer but I would use php to save it to disk or the db. How can I do this and pull in all the css, images, etc? Thanks! Or if you don't have access to curl, you can use file_get_contents() on a URL if allow_url_fopen=on. -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] saving outside website content via php...
Yes, but file_get_contents will get me the code which I could then echo back out to the browser but that wouldn't give me any external images, css files or js. On Sun, Jun 1, 2008 at 11:23 AM, Shawn McKenzie [EMAIL PROTECTED] wrote: Gabriel Sosa wrote: why no just save the searhed url in a db field. next time you just need call the iframe with the last or N search anyway if you still want to save all the searched page try using curl http://ar.php.net/manual/en/function.curl-exec.php saludos On Sat, May 31, 2008 at 8:11 PM, blackwater dev [EMAIL PROTECTED] wrote: I'm using the google api to allow people to search the web via my site. The pages are simply iframed within my site. Is it possible for me to give them a 'save' button and let them save the page they are viewing in it's current state? I don't mean save to their computer but I would use php to save it to disk or the db. How can I do this and pull in all the css, images, etc? Thanks! Or if you don't have access to curl, you can use file_get_contents() on a URL if allow_url_fopen=on. -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] saving outside website content via php...
I'm using the google api to allow people to search the web via my site. The pages are simply iframed within my site. Is it possible for me to give them a 'save' button and let them save the page they are viewing in it's current state? I don't mean save to their computer but I would use php to save it to disk or the db. How can I do this and pull in all the css, images, etc? Thanks!