Jump to content

waddledoo

Members
  • Posts

    38
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

waddledoo's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. This code: <?php date_default_timezone_set('Canada/mountain'); //this is on my computer; on the webhost it is unnecessary echo date('H:i:s'); putenv('TZ=UTC'); echo "<br>"; echo date ('H:i:s'); ?> Is displaying this: 20:01:30 20:01:30 What am I doing wrong? EDIT: I don't know what the issue is on my own computer, but using the 'putenv' with the webhost works perfectly, thanks!
  2. How would I change the current timezone used within a php script? The method I usually use, date_default_timezone_set() is undefined on my webhost, so I am trying to find another way.
  3. The file was in public_html so I could test run the script myself. Regardless, I believe the script is running correctly now. However, it isn't sending me any messages, error or otherwise, so I will have to further test.
  4. I can't exactly use commands to find out where I am, as I don't have any access to a typical command line. I'm running windows, and using my web browser to access cPanel for my website online. So, I need to type ~/public_html chmod +x (filepath)/public_html/(filename).php OR is it (filepath)/public_html chmod +x (filepath)/public_html/(filename).php or am I still way off
  5. So I would enter either /public_html/(file).php OR /usr/bin/php -f /public_html/(file).php (^^or w/e the path is) EDIT: Before you replied, I tried entering '$ chmod +x file.php' and received the error /bin/sh: $: command not found
  6. I'm trying to run from cronjobs through cPanel on my webhost. I'll include a screenshot
  7. Is the line #!/usr/bin/php placed before the <?php //code ?> in the script? Also, I put the filename in the command line, and got the following error: /bin/sh: (file).php: command not found
  8. I am not sure where else I could post this, so for now it's going here. I am trying to run a PHP script once every 40 minutes using cron, accessed through the cPanel of my webhost. The interface allows me to input the time and a command. The time is easy, I know how to use that part. However, I am not sure what to enter for the command exactly.
  9. curl_setopt($ch,CURLOPT_FOLLOWLOCATION => true); curl_setopt($ch,CURLOPT_RETURNTRANSFER => true); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER => false); To that effect? EDIT: I get the error Parse error: parse error, unexpected T_DOUBLE_ARROW With the code. I changed the => to = with no effect. How do I properly use this function then? Second EDIT: I replaced the => with , (commas) ex/ curl_setopt($ch,CURLOPT_SSL_VERIFYPEER ,false); And I no longer get errors. My code still seems to not be running properly later in the program, and I am debugging now to find what is wrong. However, this particular post seems to be solved.
  10. The URL contains the following: <api> <currentTime>2011-12-12 21:21:57</currentTime> <result> <rowset name="entries" key="refID" columns="date,refID,refTypeID,ownerName1,ownerID1,ownerName2,ownerID2,argName1,argID1,amount,balance,reason"> <row date="####-##-## ##:##:##" refID="#####" refTypeID="#####" ownerName1="#####" ownerID1="#####" ownerName2="#####" ownerID2="#####" argName1="#####" argID1="#####" amount="#####" balance="#####" reason="#####"/> <row date="####-##-## ##:##:##" refID="#####" refTypeID="#####" ownerName1="#####" ownerID1="#####" ownerName2="#####" ownerID2="#####" argName1="#####" argID1="#####" amount="#####" balance="#####" reason="#####"/> <row date="####-##-## ##:##:##" refID="#####" refTypeID="#####" ownerName1="#####" ownerID1="#####" ownerName2="#####" ownerID2="#####" argName1="#####" argID1="#####" amount="#####" balance="#####" reason="#####"/> (etc etc...) </rowset> </result> <cachedUntil>2011-12-12 21:48:57</cachedUntil> </api>
  11. I am trying to get an XML file from a URL, but am instead getting errors. The code worked perfectly when executed on my own computer through a localhost server, but when executed through my webhost's server I get the errors. I am running PHP 5.3.8, and my webhost is running PHP 5.2.17, so I am assuming this may be an error between versions. $ch = curl_init($url); // Set the options for this request//This section returned a function not found error when activated on the webhost's server /*curl_setopt_array($ch, array( CURLOPT_FOLLOWLOCATION => true, // Yes, we want to follow a redirect CURLOPT_RETURNTRANSFER => true, // Yes, we want that curl_exec returns the fetched data CURLOPT_SSL_VERIFYPEER => false, // Do not verify the SSL certificate ));*/ // Fetch the data from the URL $data = curl_exec($ch); // Close the connection curl_close($ch); // Return a new SimpleXMLElement based upon the received data //The following is line 27 in the code if (!$xml = new SimpleXMLElement($data)) echo 'FAIL.'; Errors: Warning: Entity: line 1: parser error : Start tag expected, '<' not found in /home/(etc etc) on line 27 Warning: 1 in /home/(etc etc) on line 27 Warning: ^ in /home/(etc etc) on line 27 Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /home/(etc etc):27 Stack trace: #0 /home/(etc etc)(27): SimpleXMLElement->__construct('1') #1 /home/(etc etc)(71): retrieveXMLdata() #2 {main} thrown in /home/(etc etc) on line 27
  12. I have restarted the server several times, and my computer aswell. Under phpinfo(): Configuration File (php.ini) Path C:\Windows Loaded Configuration File C:\PHP\php.ini So it would appear yes, this is the config file; unless there it is displayed somewhere else, but disabling other extensions such as mysqli in the file I am using effects the server. Is it possible the .dll file for curl is broken? EDIT: After some further research into the cURL dll file, I found out it uses two other dll files (libeay32 and sslea32), and it was suggested that they be copied into the C:\Windows folder. After doing this, all cURL functions are running, and cURL is appearing in my phpinfo()
  13. Fatal error: Call to undefined function curl_init() in C:\(etc etc...) Now I know the usual causes for a problem like this, but they are not solving anything. Yes, extension=php_curl.dll is uncommented in the php.ini file. Yes, phpinfo() displays the php.ini file I have been editing as the Loaded Configuration File. Yes, extension_dir is set correctly in my php.ini file (other extensions work). Yes, php_curl.dll exists in my ext/ folder. No, phpinfo() does not display anything about cURL, anywhere Where else can I look to possibly fix this?
  14. Alright, thanks. I'll use Task Scheduler on my machine to test the code, while I figure out the webhost's system
  15. Alright, the webhost does allow use of Cron. I have never used it before; is it as simple as giving it a code and telling it when to run it?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.