Safely get http content in cron

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
User avatar
serek
Registered User
Posts: 54
Joined: Fri Jan 30, 2015 12:47 pm
Location: London
Name: Serge Victor
Contact:

Safely get http content in cron

Post by serek »

My extension requires a daily update of a text file which is available on github.

I plan to use php/curl via cron, but my concern is that there is always a chance that network connection fails and the content of download can be partially damaged which will screw the purpose of my extension.

Can you recommend any method how I can verify the download to be sure the downloaded file is a correct copy of the one stored in github?

User avatar
3Di
Former Team Member
Posts: 14738
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: Safely get http content in cron

Post by 3Di »

If the file has an hash compare it.
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
:studio_microphone: Premium extensions @ The Studio

User avatar
serek
Registered User
Posts: 54
Joined: Fri Jan 30, 2015 12:47 pm
Location: London
Name: Serge Victor
Contact:

Re: Safely get http content in cron

Post by serek »

I'm answering my own question with help from stack overflow. I will use GitHub anonymous API to get a file as JSON including SHA control sum, which fully confirms that downloaded file is not modified.

https://developer.github.com/v3/repos/c ... t-contents

Post Reply

Return to “Extension Writers Discussion”