download an html file via wget and pass it to mysql and update a database


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting download an html file via wget and pass it to mysql and update a database
# 1  
Old 04-28-2011
download an html file via wget and pass it to mysql and update a database

CAN I download an html file via wget and pass it to mysql and update a database field?
# 2  
Old 04-28-2011
YES, you CAN!
# 3  
Old 04-28-2011
You're the second person to say that.

It might be the RIGHT answer, technically speaking.

But it is not helpful!

OP: Please phrase your question better. Such as "How can I ...".
# 4  
Old 04-28-2011
Yes i was the first to have the same reply.

I know it's not helpful but i think, it's the best answer we can have to such a generic and unclear question.
# 5  
Old 04-28-2011
You are right, scottn, but please don't mind, that was just a joke.
I hope I could always be helpful.

Code:
html=`wget -q -O - http://url.com`
# html=`curl -s http://url.com` # would be more succinct
mysql -uuser -ppwd -h HOST -P PORT -D DB_NAME -A -e "UPDATE TABLE SET COLUMN=\'$html\' WHERE x=y"

Note: you may have to escape some special characters in $html for MySQL, otherwise, the UPDATE statement may fail.

---------- Post updated at 11:31 AM ---------- Previous update was at 11:28 AM ----------

Quote:
Originally Posted by Chirel
Yes i was the first to have the same reply.

I know it's not helpful but i think, it's the best answer we can have to such a generic and unclear question.
Smilie
# 6  
Old 05-14-2011
I use it in this way but I have this error:
syntaxa error at line 26


Code:
mysql -v -v -v -uXXX -pYYYYY -e 'UPDATE products \
INNER JOIN tb_GGGGG ON products.products_model = tb_GGGGG.ItemID \
INNER JOIN products_description ON products.products_id = products_description.products_id
SET \
products_description.products_description = \'$html\'  WHERE  (products.products_model = "Y")' MYDB


Last edited by Franklin52; 05-18-2011 at 04:04 AM.. Reason: Please use code tags
# 7  
Old 05-16-2011
if instead of $ html put '1234567890 'then the query works
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Using symbolic link for database MySQL in CentOS, not update sizing

I have no idea what I should set the topic here ==' This is my story, please you there kindly help me I'm quite newbie for this. ================================== My host server is CentOS, I spared 9.9GB for /var path that used by MySQL and...It's full because of heavy load traffic, then... (1 Reply)
Discussion started by: Kapom
1 Replies

2. Shell Programming and Scripting

Wget download file ( do not overwrite )

Hello all, I want to write auto update script for my embedded device, which can check and download newer version of my program and extract the files on the device. The download center is hosted on remote web server . Script checks the hosted file on web site and if the new version is there... (8 Replies)
Discussion started by: stefki
8 Replies

3. Shell Programming and Scripting

Scrape 10 million pages and save the raw html data in mysql database

I have a list of 10 million page urls. I want those pages scraped and saved in the mysql database as raw html. I own a Linux VPS server with 1GB RAM and WHM/cPanel. I would like to scrape at least 100,000 urls in 24 hours. So can anyone give me some sample shell scripting code? (4 Replies)
Discussion started by: Viruthagiri
4 Replies

4. Shell Programming and Scripting

MySQL bulk retrieval of database through html form

Have to delete this long post. Seems nobody would spent time on it. (0 Replies)
Discussion started by: yifangt
0 Replies

5. Shell Programming and Scripting

How to download file without curl and wget

Hi I need a Shell script that will download a zip file every second from a http server but i can't use neither curl nor wget. Can anyone will help me go about this task ??? Thanks!! (1 Reply)
Discussion started by: rubber08
1 Replies

6. Shell Programming and Scripting

How to download to a file using wget in perl?

Hi, I want to download some online data using wget command and write the contents to a file. For example this is the URL i want to download and store it in a file called "results.txt". #This is the URL. $url="http://www.example.com"; #retrieve data and store in a file results.txt ... (3 Replies)
Discussion started by: vanitham
3 Replies

7. UNIX and Linux Applications

download file using wget

I need to download the following srs8.3.0.1.standard.linux26_32.tar.gz file from the following website: http://downloads.biowisdomsrs.com/srs83_dist There are many gzip files along with the above one in the above site but I want to download the srs8.3.0.1.standard.linux26_32.tar.gz only from... (1 Reply)
Discussion started by: alphasahoo
1 Replies

8. Shell Programming and Scripting

download a particular file using wget

Hi All I want to download srs8.3.0.1.standard.linux24_EM64T.tar.gz file from the following website : http://downloads.biowisdomsrs.com/srs83_dist/ But this website contains lots of zipped files I want to download the above file only discarding other zipped files. When I am trying the... (1 Reply)
Discussion started by: alphasahoo
1 Replies

9. UNIX for Dummies Questions & Answers

Using wget to download a file

Hello Everyone, I'm trying to use wget recursively to download a file. Only html files are being downloaded, instead of the target file. I'm trying this for the first time, here's what I've tried: wget -r -O jdk.bin... (4 Replies)
Discussion started by: thoughts
4 Replies

10. Shell Programming and Scripting

Script to download file using wget

Hi I need a Shell script that will download a text file every second from a http server using wget. Can anyone provide me any pointers or sample scripts that will help me go about this task ??? regards techie (1 Reply)
Discussion started by: techie82
1 Replies
Login or Register to Ask a Question