NylonAdmiral Posted February 12, 2010 Share Posted February 12, 2010 Hi All, This is my first post at Phpfreaks so please excuse me if there is a really simple solution to this that I haven't figured out! I don't really even know what to search for within the forums as I don't even know what you'd call a task like this OK, so here is my problem. I have an ecommerce website built using a common CMS package, this site needs to interact with another third party piece of mail order/stock management software. At present when someone makes an order on the site the order is added to the site's datbase for processing. After logging into the admin pages of the site there is a page where it is possible to export orders. I didn't actually create this page, someone far more knoweledgeable than myself did and made it available through a forum for other users. That was over a year ago though so sourcing help from that forum is proving difficult. Basically there is a link on the admin site that when clicked exports (as .CSV files) all the orders that have been placed and emails them to someone who then imports those orders into the mail order software so they can be processed. I know this sounds a bit long winded but I was given their existing method and asked to work with it. Basically all I want to do is take the task that is executed by clicking on the link and make it into a cron job or something. This way if it was executed every 15min or so the whole process would become completely automated and noone would have to keep logging in to click the export button. Unfortunately I have no idea how to achieve this! The code for the link is: <a href="?export=true&type=fromlast" onclick="this.href += '&sample='+getValueSelected(getElementById('sz_type1'));" id="sz_export1">Export</a> I know this probably doesnt provide anywhere near enough info to help solve this problem but maybe it will give some idea of what I am trying to achieve. Any help would be REALLY appreciated as this is the last thing I need to fix! Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/191880-automatically-execute-link/ Share on other sites More sharing options...
roopurt18 Posted February 12, 2010 Share Posted February 12, 2010 Install FireFox with the Firebug add-on. Open firefox and then open firebug. Click on the Net tab in firebug. Now as you browse the site firebug will display all of the network communications sent back and forth. Browse to the page in question. Wait for it to load entirely. Then click the Clear button in firebug. This erases all of the traffic thus far. Now click on the link in question. Firebug will display what the link actually does. It will tell you: 1) Which URL was accessed 2) The type of request (POST or GET) 3) If the request was a POST you can also view any POST data that was sent. Now you can write a simple script using HttpRequest or libCurl that will access the same URL in the same manner with the same passed data. HttpRequest (or libCurl) will give you the output, which is your CSV file. You can then use the mail() function to e-mail it. I'd recommend using PHPMailer() instead though. It has many nice features. Link to comment https://forums.phpfreaks.com/topic/191880-automatically-execute-link/#findComment-1011506 Share on other sites More sharing options...
NylonAdmiral Posted February 13, 2010 Author Share Posted February 13, 2010 You sir are a genius! Thank you so much for your help. That worked perfectly. I was already using firebug but had never used that feature before which is very useful in itself. Thanks again. Link to comment https://forums.phpfreaks.com/topic/191880-automatically-execute-link/#findComment-1011759 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.