01-01-2019 03:58 PM
Hello everyone. I need to check if a website page exists or not. In particular, I would like to check if a URL actually leads to a web page or not, and be able to get an "error404" or something else from the page in real time. I use LabVIEW 2009 and I have no clue how to do that. I've been trying so far with DataSocket, Connectivity tool, and so on... but it just does not seem to work. Do you know how I could manage all of this?
Thank you.
01-01-2019 04:42 PM - edited 01-01-2019 04:46 PM
Hi gears,
why don't you try to load your webpage using datasocket? You will either get the HTML code or an error indicating a non-existing page...
01-02-2019 02:01 AM
Use the HTTP GET function, the headers will contain the response code.
0xDEAD
01-02-2019 08:17 AM
Do you have a HTTP VI library that is compatible with LabView 2009?
@deceased ha scritto:
Use the HTTP GET function, the headers will contain the response code.
0xDEAD
01-02-2019 08:25 AM
Hello and thank you for your help. I actually have tried this structure in particular, but it seems not to be working. Whether or not the URL exists, the data shown are always the same... so it is impossible for me to get a string from the code given that refers to an existing website.
I can show you.
This is what I get although the given URL actually does not exist:
http://pegaso.multiversity.click/main/lp-video_student_view/lesson_student_view.php?lp_id=291&id_les...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+ARIA 1.0//EN" "http://www.w3.org/WAI/ARIA/schemata/xhtml-aria-1.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Piattaforma Unipegaso</title> <meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /><link type="text/css" href="https://pegaso.multiversity.click/main/inc/lib/header-bootstrap/bootstrap/css/bootstrap.css" rel="stylesheet"><link rel="stylesheet" href="https://pegaso.multiversity.click/main/css/dokeos2_pegaso/font/css/font-awesome.min.css" /><link href="https://pegaso.multiversity.click/main/inc/font/font-awesome.4.7.0/css/font-awesome.min.css" rel="stylesheet" /><link href="https://pegaso.multiversity.click/main/css//default.bootstrap.css" rel="stylesheet" /><link href="https://pegaso.multiversity.click/main/inc/lib/header-bootstrap/ui/css/custom-theme/jquery-ui-1.10.3..." rel="stylesheet" /><script type="text/javascript" src="https://pegaso.multiversity.click/main/inc/lib/header-bootstrap/jquery/jquery.js" language="javascript"></script><script type="text/javascript" src="https://pegaso.multiversity.click/main/inc/lib/header-bootstrap/bootstrap/js/bootstrap.min.js" language="javascript"></script><script type="text/javascript" src="https://pegaso.multiversity.click/main/inc/lib/javascript/stickyfooter.js" language="javascript"></script><script type="text/javascript" src="https://pegaso.multiversity.click/main/inc/lib/javascript/dokeos.js.php" language="javascript"></script><script type="text/javascript" src="https://pegaso.multiversity.click/main/inc/lib/header-bootstrap/ui/assets/js/vendor/jquery-ui-1.10.3..." language="javascript"></script></head><body><div><div class="logo-login"></div><div class="container">
<div class="row">
<div class="col-md-4 col-md-offset-4 text-center">
<img class="logo-image" src="https://pegaso.multiversity.click/main/inc/lib/header-bootstrap/img/logopage.png" style="max-width: 200px; margin:10px;" alt="Logo Pegaso" />
</div>
<div class="col-md-4 col-md-offset-4">
<div class="panel panel-default">
<div class="panel-heading">ACCEDI ALLA PIATTAFORMA</div>
<div class="panel-body">
<form class="form-signin" action="" method="post">
<div class="form-group">
<label class="sr-only" for="inputUserName">Username</label>
<input name="login" id="inputUserName" class="form-control" placeholder="Username" required="" autofocus="" type="text" />
</div>
<div class="form-group">
<label class="sr-only" for="inputPassword">Password</label>
<input id="inputPassword" class="form-control" placeholder="Password" required="" name="password" type="password" />
</div>
<div class="form-group">
<button class="btn btn-lg btn-default btn-block" type="submit" style="background-color: #333333; color: #fff;">Entra</button>
<a class="btn btn-lg btn-default btn-block" type="button" href="https://pegaso-accessibile.multiversity.click/login.html">Vai alla versione accessibile</a>
</div>
</form>
</div>
</div>
</div>
</div>
</div></div></body></html>
01-02-2019 08:47 AM
I don't have anything as old as 2009 installed.
In the version I use they are located in the "Data Communication -> Protocols -> HTTP Client" palette.
01-02-2019 08:51 AM
I've actually found this:
https://forums.ni.com/t5/NI-Labs-Toolkits/LabVIEW-HTTP-Client/ta-p/3500778
I've tried it, but it seems not to be working. It just displays the presumable data of the non-existing website that I ask LabVIEW to check.
What if I want to detect a general error from a website... like "error400" or "error500"? Do you know how I could arrange such a system?
01-02-2019 09:00 AM
@Gears_math wrote:
Hello and thank you for your help. I actually have tried this structure in particular, but it seems not to be working. Whether or not the URL exists, the data shown are always the same... so it is impossible for me to get a string from the code given that refers to an existing website.
I can show you.
This is what I get although the given URL actually does not exist:
http://pegaso.multiversity.click/main/lp-video_student_view/lesson_student_view.php?lp_id=291&id_les...
That website does exist. It returns a login page.
01-02-2019 09:08 AM
Hello and thank you for your help. Actually, I am logged in to the website. When you are logged in, if the URL exists, you get redirected to an existing page... but if it does not exist, you get an "error500" from the browser.
You cannot see this because you are not logged in, so you get redirected to the login webpage.
In this website, some videos are contained inside of some kind of folders which are shown in the URL.
This is an example of a URL:
https://pegaso.multiversity.click/main/lp-video_student_view/lesson_student_view.php?lp_id=45&id_les...
in which lp_id=45 is the folder and lesson=241 is the video
If I change the number of the video to a non-existing one I get an "error500" from the browser which unfortunately I cannot detect, at least with the system I've build-up.
Any suggestion? Thank you.
01-02-2019 09:46 AM - edited 01-02-2019 09:46 AM
I just tried with the HTTP example I posted I get the following header returned and no body.
HTTP/1.1 302 Found
Date: Wed, 02 Jan 2019 15:41:35 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 0
Connection: keep-alive
Server: Apache/2.4.29 (Ubuntu)
X-Powered-By: PHP/5.6.38-3+ubuntu18.04.1+deb.sury.org+1
Set-Cookie: dk_sid=0d016a687ee315e4e126706875b990f5; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Location: https://pegaso.multiversity.click/
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE
0xDEAD