Ubuntu terminal access a website every day

Asked

Viewed 436 times

0

I am working with a Webservice (SOAP + XML) that requires access every day on a link, I want to automate this service on my Ubuntu Server, I thought of using Lynx along with Crontab to access the link and then close, follow the Crontab code:

0 6 * * * lynx https://site.com/WebService
1 6 * * * killall lynx

So, access occurs every day, at the same time and after a minute it closes everything that exists of Lynx, the problem is that it does not work!

It accesses the link, but it’s as if "I didn’t activate the XML" of the page, so Webservice doesn’t work

The page code was developed in PHP and using Curl to call/run XML. If you access the link through a browser, it works perfectly

Is there any way to solve this? Or another method to automate this access?

1 answer

1


Tried to use CURL directly? So:

0 6 * * * curl --silent https://site.com/WebService

A question? Do you need PHP to call the webservice? I mean unless you need to save something on the site, like passwords or downloaded data or send data from the site, you could access WS directly from the terminal, or create a PHP script on the same machine, of course I’m guessing all this, because I don’t know how you’re doing.

But if you don’t have any specific reason to use host the script on the site then you could do something like:

0 6 * * * php /home/meuusuario/scripts/webservice.php
  • I do need PHP! Because it is an integration of websites, PHP together with Curl create an XML and send it, so I get the return information, which is a session number, saying that "I am connected to Webservice", I have to run every day because this session lasts 2 days.. I can post any part of the code if you want to see! For this reason I can not host on the site it, I will try the script you made and see the result!

  • Try only using the curl --silent, maybe it already works. @user70876

  • 1

    I just performed a test here and it already worked!! I have already accessed the services of Webservice! I’ve already added to Crontab, tomorrow I check if you’ve updated again! Thanks! I’ll mark your reply as correct!!

  • @user70876 you can wait until tomorrow to mark the answer, first make the necessary tests. See you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.