Jump to content

Downloading an image from a Web server using Datascoket


Recommended Posts

  • 3 weeks later...
  • 2 months later...

:lightbulb: Yes, this can be used on any html page that you want to get off the web. Once the data is received you can just parse out the important content.

I made a VI that gets the nymber of registered LAVA forum users. I attached an image that shows how to do this. As you see, once the html page is retrieved, the rest of the process is just plain text string manipulation.

post-10-1073765628.gif?width=400

Link to post
  • 6 months later...
  • 1 year later...
:lightbulb: Yes, this can be used on any html page that you want to get off the web. Once the data is received you can just parse out the important content.

I made a VI that gets the nymber of registered LAVA forum users. I attached an image that shows how to do this. As you see, once the html page is retrieved, the rest of the process is just plain text string manipulation.

285[/snapback]

It should be noted that unless your URL ends with ".html" then you may need to add "

" (note the space) to your URL string to get this to work right.  Maybe ftp sites need something simular to get them to work?

-John

Link to post
  • 9 months later...
It should be noted that unless your URL ends with ".html" then you may need to add "
" (note the space) to your URL string to get this to work right.  Maybe ftp sites need something simular to get them to work?

-John

I use the " [text]" to retrive .rss and .xml pages as big strings. The xml pages are very easy to parse.

Link to post
  • 5 months later...
Chris,

This is nice. It also supports FTP URLs. However, I tried it on Linux and I get Error 1181 - "Protocol unrecognized by DataSocket" :(

-Jim

My app will have to read a web page & parse HTML contents continuosly. Do you folks suggest opening a datasocket session, reading the contents and explicity closing the datasocket connection with each loop iteration?

Thanks

Robert

Link to post
My app will have to read a web page & parse HTML contents continuosly. Do you folks suggest opening a datasocket session, reading the contents and explicity closing the datasocket connection with each loop iteration?

I don't think so - like all reference-based programming, you should open and close the reference outside of the loop. That said, as the connection is completely under your control (ie: remote can close it), I'd also check the connection inside the loop if you find that you're having difficulty reading the page.

Link to post
I don't think so - like all reference-based programming, you should open and close the reference outside of the loop. That said, as the connection is completely under your control (ie: remote can close it), I'd also check the connection inside the loop if you find that you're having difficulty reading the page.

Lets say one opens a datasocket connection before entering the while loop. The datasocket read VI has a polymorphic input as the current open connection or URL input. What if within the SAME connection I want to view different HTML page after each iteration of the while loop? You would think I could just pass a string input denoting the URL but the read VI wants a connection input with each iteration of the loop if opening a datasocket connection before entering the loop. So do I just use the read VI in the loop passing a different URL string input & assume LabVIEW is smart enough to close the connection after existing the VI so I don't get memory leak?

Link to post
Lets say one opens a datasocket connection...

Could you please mock-up a VI ro two to explain what you're asking? It'd be a whole lot easier to discuss what you're asking with something graphical to work with :)

Link to post
  • 5 months later...
  • 9 months later...
  • 4 months later...

QUOTE (san26141 @ Jul 7 2008, 09:26 PM)

I can't open the vi (Displaying_an_image_from_a_web_page.vi ) or image. An "error" pops up saying that they may have been moved or deleted. Where can I download this vi if it is still available?

Thanks

Several options:

  • Crelf removed it
  • It got lost in the archives of the internet
  • LabVIEW has sent a bot to the LAVA database removing this attachment

But the code is quite simple, and you can easily recreate it from the images supplied. Oops the image is gone too.

A similar piece of code is given on the dark side.

Ton

Link to post

QUOTE (san26141 @ Jul 7 2008, 03:26 PM)

I can't open the vi (Displaying_an_image_from_a_web_page.vi ) or image. An "error" pops up saying that they may have been moved or deleted. Where can I download this vi if it is still available?

I tried updating the link, but it isn't working. Here's another copy:

Download File:post-181-1215466225.vi

Edit: OK - that one doesn't work either. Reported to the admin.

Link to post
  • 2 months later...

Keep receiving "Sorry, some required files are missing, if you intended to view a topic, it's possible that it's been moved or deleted. Please go back and try again" when attempt to download VIs from posts 1 & 2 or open pictures..

Would like to have these VIs.. looks soo interesting.

Thanks,

Alex

Link to post

QUOTE (iowa @ Sep 10 2008, 12:51 AM)

Keep receiving "Sorry, some required files are missing, if you intended to view a topic, it's possible that it's been moved or deleted. Please go back and try again" when attempt to download VIs from posts 1 & 2 or open pictures.

Here's a quick example that I just threw together:

Link to post
  • 5 months later...

hi.. i've tested your .vi.. it worked perfectly fine for my requirements except for a bit minor problems.. i can't seems to identify where the problem lies as i'm still pretty new at labview.. an example of the website would be: test link

the profile picture cannot be loaded by the application and the one with little bars as well.. only the parking lots picture could be loaded.. i was wondering if you could help me solve this mystery? i really cannot find out the reason behind this phenomena.. thanks in advance

Link to post

QUOTE (Tham @ Mar 2 2009, 10:43 AM)

an example of the website would be: http://amp.ece.cmu.edu/people/Qi/' rel='nofollow' target="_blank">test link the profile picture cannot be loaded by the application and the one with little bars as well.. only the parking lots picture could be loaded..

I can't get through to your site at the moment - it's not responding - so I can't really give you an authorative answer. Check whether the images you can't download are actually images, and not links to somewhere else, or embedded applications (like flash).

Link to post

i've tested the link again.. it's still working.. i right click and select "copy image location" to get the url to paste it there and right click at "view image" and copy the url at the top of my browser and i've obtained different results.

"copy image location"

Profile picture failed, 2nd picture failed and the parking picture fail as well(though yesterday seems to be working even though i made no changes

"view image" and use the url:

profile picture worked but the rest failed..

thanks in advance

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.