bbb Posted February 23, 2018 Share Posted February 23, 2018 I have a page with a template that is purely intended for carrying out php tasks. This page/url is called when certain objects in SalesForce are saved. The URL is called with a few GET variables. To make sure that the URL with the GET variables is called, I write them to a log, and this works fine, except the php and ProcessWire code I've written doesn't execute. Only once I visit the exact same URL that was written to the log in my browser, then the php and ProcessWire code executes perfectly, no errors. I can't see any reason for this, and I'm not sure what to search for in order to sort this out. Can anyone give any ideas? Link to comment Share on other sites More sharing options...
bbb Posted February 23, 2018 Author Share Posted February 23, 2018 Okay, so my code doesn't seem to like the following when not being loaded in the browser: contact=[salesforce_id^=$sfid] Link to comment Share on other sites More sharing options...
louisstephens Posted February 23, 2018 Share Posted February 23, 2018 PHP is a server-side scripting language, and sends the data to the client on page load. To get the script to run without a page view, you would need to set up a cron job. Cron jobs are used for scheduling tasks/scripts to run on the server. If you are using shared hosting, there is normally a tool in the control panel for setting up and managing cron jobs. Link to comment Share on other sites More sharing options...
dragan Posted February 23, 2018 Share Posted February 23, 2018 1 hour ago, Barry said: contact=[salesforce_id^=$sfid] yep. I'm not even sure what that code is: PHP, JS? Cron jobs won't do anything with JS+CSS... or HTML, for that matter. 1 Link to comment Share on other sites More sharing options...
bbb Posted February 23, 2018 Author Share Posted February 23, 2018 sorry, my original post may not be clear: $contact = $pages->get("salesforce_id^=$sfid"); $location = $pages->get("template='pageLocation', contact=[salesforce_id^='$sfid']"); the top line $contact returns a processwire ID whether the URL is called by salesforce or by my browser. $location does not return anything when salesforce calls it but returns a processwire ID when I call the URL in my browser. Link to comment Share on other sites More sharing options...
BitPoet Posted February 23, 2018 Share Posted February 23, 2018 30 minutes ago, Barry said: $location does not return anything when salesforce calls it but returns a processwire ID when I call the URL in my browser. Were you logged in to the backend when it worked? If yes, you might have a permissions issue. Link to comment Share on other sites More sharing options...
bbb Posted February 23, 2018 Author Share Posted February 23, 2018 No, being logged in or not makes no difference. These two lines of code run at the same time. It just seems like a nested selector won't work unless the page is viewed in a browser. I've managed to get it working with the following: $contact = $pages->get("salesforce_id^=$sfid"); $location = $pages->get("template='pageLocation', contact=$contact"); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now