PHP - Help Urgently Needed Resolving Php Cron File Errors
I have purchased a ad manager type script and have put so much work in to the site but i cannot get the cron file to execute properly due to errors. The makers of the script arent answering my emails so I am left to find the answer myself im hoping some experts can shine a light on this for me
I have the cron running once daily as required
the error messages are as follows:
/home2/net2you/public_html/2xx.co.uk/include/CronStats.php: line 1: ?php: No such file or directory
/home2/net2you/public_html/2xx.co.uk/include/CronStats.php: line 2: syntax error near unexpected token `;' /home2/net2you/public_html/2xx.co.uk/include/CronStats.php: line 2: `ob_start();' I have installed the script on two different hosts and get the exact same errors. any help would be much appriciated the contents of the cron file are below ______________________________________________ <?php Similar TutorialsI have set up my PayPal IPN and it works perfectly when sending test IPN's using the IPN Simulator on the PayPal developer website. When I change the ssl in this line Code: [Select] $fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);to Code: [Select] www.paypal.com It no longer works. It comes back as INVALID, not VERIFIED. Anyone know what the problem could be? My IPN is below. You'll see there is entries into the log table, this is just for testing purposes, and how I found out that it's coming back as INVALID and not VERIFIED. Thanks Denno <?php //connect to the database here include "../scripts/connect_to_mysql.php"; //------------------------------- // PHP 4.1 // read the post from PayPal system and add 'cmd' $req = 'cmd=_notify-validate'; foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; } // post back to PayPal system to validate $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; $fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30); // assign posted variables to local variables $team_name = $_POST['item_name']; $item_number = $_POST['item_number']; $payment_status = $_POST['payment_status']; $payment_amount = $_POST['mc_gross']; $payment_currency = $_POST['mc_currency']; $txn_id = $_POST['txn_id']; $receiver_email = $_POST['receiver_email']; $payer_email = $_POST['payer_email']; $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $associated_club = $_POST['custom']; $contact_number = $_POST['invoice']; if (!$fp) { // HTTP ERROR } else { fputs ($fp, $header . $req); while (!feof($fp)) { $res = fgets ($fp, 1024); if (strcmp ($res, "VERIFIED") == 0) { //User code is added below here $dateField=date("Y-m-d H:i:s"); $sqlCommand = "INSERT INTO log VALUES('','$dateField','$payment_status','$payment_amount','$payment_currency','1','0')"; $update = mysql_query($sqlCommand, $myConnection); if($payment_status == "Completed"){ if($payment_amount == '40.00' && $payment_currency == "AUD"){ //process payment and enter information into database $sqlCommand = "INSERT INTO teams VALUES ('','$first_name','$last_name','$associated_club','$team_name','$contact_number','1')"; $update = mysql_query($sqlCommand, $myConnection); } } //User code is added above here } else if (strcmp ($res, "INVALID") == 0) { // log for manual investigation $dateField=date("Y-m-d H:i:s"); $sqlCommand = "INSERT INTO log VALUES('','$dateField','$payment_status','$payment_amount','$payment_currency','0','1')"; $update = mysql_query($sqlCommand, $myConnection); } } fclose ($fp); } echo "$sqlCommand"; ?> when i insert this code into my php script my cron job wont work include($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'facebook' . DIRECTORY_SEPARATOR . 'globalFunctions.php'); it is giving this error Warning: include(/facebook/globalFunctions.php) [function.include]: failed to open stream: No such file or directory in /home/cork/public_html/facebook/fbFriendAdder/all/addFrndOfFrnd.php on line 13 Warning: include() [function.include]: Failed opening '/facebook/globalFunctions.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/cork/public_html/facebook/fbFriendAdder/all/addFrndOfFrnd.php on line 13 what is causing this problem and why does it work fine when i run the script manually?? Hi All, Im new to here, so a big HI to all I have been pulling my hair out trying to remove some errors from a wordpress plugin, the vendor says its fine but when you end up with log files over 40MB and have to delete each few days I'm not convinced From the many lines of my log file I have these [12-Mar-2019 20:48:23 UTC] PHP Warning: Invalid argument supplied for foreach() in /home/xxxxxxx/public_html/wp-content/plugins/streamline-core/resortpro.php on line 202 Line starting 199 to 205 of the addressed file function streamshare_rewrite_rules(){ $resortPro = ResortPro(); $rules = $resortPro->ssml_routes_for_search_results_pages(); foreach($rules as $page_s_id => $rule) { add_rewrite_rule(''.$rule.'/(.+)/?','index.php?page_id='.$page_s_id.'&stream_search=$matches[1]','top'); } } Can anyone help me here
Regards
Keith First thanks for any help that you can provide. I am somewhat new to PHP and this is the first "Web Service" I have had to create. THE GOAL: I need to pull XML data from another server. This company's API is setup so that you must give an IP and so you can only pull data from server to server instead of client to server. The data is pulled from the API using HTTP requests...very similar to YQL. (in essence the structured query is located in the URL). This API also requires that my server only ping's their server every 10-15 mins, in order to cut down on server requests. The logical thought in my head was to setup: a cron job to run a PHP script every 10 mins. The PHP scripts would then do the following: 1. Make the HTTP request 2. Open an existing file or create one (on my server) 3. Take the returned XML data from the API and write to the newly opened file. 4. Convert that XML to JSON. 5. Save the JSON 6. Cache the JSON file 7. STOP My thought was to use curl and fopen for the first 3 steps. I found a basic script that will do this on PHP.net (as shown below). After that I am pretty much lost on how to proceed. Code: [Select] <?php $ch = curl_init("http://www.example.com/"); $fp = fopen("example_homepage.txt", "w"); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch); fclose($fp); ?> I would REALLY appreciate any help on this. Also, if you have the time to please comment and explain what you are doing in any code examples and why....that would HELP out a lot. I truly want to learn not just grab a snippet and run. So, your comments are vital for me. thank!!! <?xml version="1.0" encoding="ISO-8859-1"?> <Note> <from> Ahmad </from> <to> Yasir </to> <body> hello yasir. </Note> Above is my xml file which misses the ending tag of <body>. i want a php program that will detect this error and also fix the error and place the ending tag. can someone help me? This topic has been moved to Installation on Linux. http://www.phpfreaks.com/forums/index.php?topic=319933.0 Hi guys, I did read allot of documentation on the internet about reading/writing/parsing an XML file. I ended up using the following code, because I really have large files (some about 200MB) and regular dom does not work: while ($xml->read()) { switch ($xml->nodeType) { case (XMLReader::ELEMENT): if ($xml->localName == "job") { $node = $xml->expand(); $dom = new DomDocument(); $n = $dom->importNode($node,true); $dom->appendChild($n); $job = simplexml_import_dom($n); The problem I have is a special character error in the xml file, error returned on this line: "$node = $xml->expand();" I am literally banging my head to the wall to find a simple solution to this. I already have a cleaning function, but that can be applied only after the code above. As the file is large, to clean it, I would have to use the same code above to work on partial content at once, so I would have the same special character problem when I would try to read and split the file. I bet I am not the first one to be in this situation, but after about 5 hours of searching on the internet, I cannot do it no more. And I am not a php expert to come up with a new idea. One other thing to do probably would be to split the file into multiple files, and read them after that, without using the XMLReader. But this would ask for a different application. If, for example, on a file where I have an error, I do the reading with simplexml, without using the XMLReader, I don't get the error. But I cannot use simplexml on the files, since file size is variable. I have to use a reliable method that works for all situations. Hopefully someone has an idea to this STUPID situation! Thanks. Hi. I have text files in the directory that contain rapidshare.com links. Now what I need to do is take them one by one and check links inside them one by one using rapidshare API. Everything works fine apart from one thing. It reads files and deletes the ones containing dead links but the problem is that it only deletes the file if ALL links are dead, but not when only one link is dead or some of them. Code: Code: [Select] <?php function rs_check($url){ if (!$url) return false; $files_pattern= '/\/files\/([^\/]*)\//'; $filename_pattern= '/\/files\/.*\/(.*)/'; preg_match($files_pattern, $url, $matches_id); preg_match($filename_pattern, $url, $matches_name); $res= file_get_contents("http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=checkfiles_v1&files={$matches_id[1]}&filenames={$matches_name[1]}"); list($fId,$fName,$fSize,$fServerId,$fStatus,$fShortHost,$fmd5) =explode(',',$res); return ($fStatus==1 || $fStatus==2); } $directory = "download/"; $linksfiles = glob("" . $directory . "*.txt"); foreach($linksfiles as $linkfile) { $lf = file_get_contents($linkfile); $purefilename = str_replace($directory, "" , $linkfile); if($purefilename != "5100c00fdb545e12e8cb4f9c5f69ec21.txt"){ if(rs_check($lf) != 1){ unlink($directory . $purefilename); echo("<br />"); } } } ?> I had Tom Cat Java installed on my Linux sever and I need to call a java file, which isn't working. Someone told me to verify Java is in fact installed on my server using this command: Code: [Select] echo exec('which java'); but when I run it, nothing displays! The java command I'm trying to run is this: Code: [Select] exec('java -Xmx1024m -jar "/home/account/public_html/java -cp b4a_c2dm.jar anywheresoftware.b4a.c2dm.C2DM send $php_device_id \"test\""'); The .jar file is there. My path to java is: /usr/local/jdk/bin/java Thanks for any help... Hi guys <?php sleep(00); $handle = fopen("http://www.myurl.com/?bla=bla=bla" , "r"); fclose($handle); ?> How do i prevent this from outputing to a file on my server. I only need the url to be accessed to add a new row of data to my DB. Any Ideas? Regards Mark Hi Guys, I am a bit of a PHP noob and I am hoping for a bit of help. My deadline to have this working is tomorrow. Basically I want to display a table which shows all the events I have signed upto. However, my code is creating windows within itself and separate tables which are all over the place. Here is my code: <?php session_start(); $email = $_SESSION['email']; include '../dbconn.php'; include '../includes/functions2.php'; $query2 = "SELECT * FROM billing where email='$email'"; $result2 = mysql_query($query2); $num_rows = mysql_num_rows($result2); while($row2 = mysql_fetch_array($result2, MYSQL_ASSOC)) { $query3 = "SELECT * FROM events where id='$row2[eventid]'"; $result3 = mysql_query($query3); while($row3 = mysql_fetch_array($result3, MYSQL_ASSOC)) { ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <link rel="shortcut icon" href="../images/favicon.ico"> <meta http-equiv="Content-Type" content="text/html; charset=iso8859-1" /> <meta name="keywords" content="Ghost Hunts, Ghost Hunting, Ghost Hunt Suppers, Overnight Ghost Hunt, Haunted Nights, Ghost Hunting Weekends, Paranormal Events, Most Haunted Tours, Most Haunted, Haunted Places, Anyone There?, Fright Nights, Haunted Happenings, Haunted Gatherings, The Hoff, Scott Mills, Yvette Fielding" /> <meta name="description" content=" Paranormal team, organising ghost hunts accross the UK. With many famous guests, only at Anyone There?" /> <link href="style.css" rel="stylesheet" type="text/css" /> <title>Anyone There :. Haunted Experiences</title> </head> <script LANGUAGE="JavaScript" SRC="overlib.js"></script> <body> <div id="container"> <div id="header"> </div> <div id="nav"> <ul> <li><a href="cprotected.php" class="selected" title="Events">My Events</a></li> <li><a href="feedback.php">Feedback</a></li> <li><a href="index.php">Logout</a></li> </ul> </div> <div id="content"> <div id="page"> <h2><?php echo "Welcome $row1[fname] $row1[sname]"; ?></h2> <br> <h2> <?php echo "Showing $num_rows events. . ."; ?> </h2> <center> <p> <?php $deposit=$row2[quantity]*10; $total=$row2[quantity]*$row2[ticketprice]; $cancel='http://www.anyonethere.co.uk/main/cprotected.php'; $paid='http://www.anyonethere.co.uk/main/paid.php'; echo " <center> <table width='800' class='reference'> <tr> <th>Venue</th> <th>Date</th> <th>Total Price</th> <th>Deposit</th> <th>Remaining</th> <th>Ticket Quantity</th> <th>Status</th> </tr> "; if ($row2[status]=='0') { echo "<tr>"; echo "<td>$row3[venue]</td> "; echo "<td>$row3[date]</td> "; echo "<td>£$total</td> "; echo "<td>£$deposit</td> "; echo "<td>£$row2[owe]</td> "; echo "<td>$row2[quantity]</td> "; echo "<td>Pay Deposit</td></tr>"; } elseif ($row2[status]=='1') { echo "<td>$row3[venue]</td> "; echo "<td>$row3[date]</td> "; echo "<td>£$total</td> "; echo "<td>£$deposit</td> "; echo "<td>£$row2[owe]</td> "; echo "<td>$row2[quantity]</td> "; echo "<td bgcolor='orange'>PAY OUTSTANDING BALANCE</td></tr>"; } elseif ($row2[status]=='2') { echo "<td>$row3[venue]</td> "; echo "<td>$row3[date]</td> "; echo "<td>£$total</td> "; echo "<td>£$deposit</td> "; echo "<td>£$row2[owe]</td> "; echo "<td>$row2[quantity]</td> "; echo "<td bgcolor='green'>Paid</td></tr>"; }}} echo "</table>"; ?> </p> </div> <div class="clear"></div> </div> <div id="footer"> <p>© 2011 Anyone The The UK's #1 for Haunted Events</p> </div> </div> </body> </html> Please can somebody give me a pointer in the right direction, it will be a life saver? Thanks in Advance, Dan Hi guys, I am not a coder, but more a graphic designer and I am currently designing a ccbill affiliate program in which I urgently need to find a way to code the following: When people visit the affiliate page, affiliates are able to log in by entering their 6 digit ccbill affiliate ID. Once they log in, they are redirected to the affiliate area, where all affiliate links are embedded with their unique ID. I have seen many affiliate sites using this simple "set cookie" script but for the life of me, can I find it online!! .. absolutly no chance. I have been looking for a way to do this for around 6 months now. Here are some examples I found on google of affiliates that are using this type of code: [links to sexually oriented sites removed.] < this is the layout I want to follow, ie three steps at the bottom of the page, with the third being the login It seems they are all using a pho file to do this. Can anyone please, please help me with this, as I think this forum is my last resort after 6 months of searching for a way to do this. Many thanks! Hi! I hope somebody can help me what im do wrong. i have checked that the data from the file is in $source_file but nothing imports to the database Code: [Select] <?php include('config.php'); include('opendb.php'); if(isset($_POST['upload'])) { $source_file = @$_POST['userfile']; //$source_file = fopen('http://localhost/test/upload/test.csv', 'r'); $target_table = 'foretag'; function csv_file_to_mysql_table($source_file, $target_table, $max_line_length=10000) { if (($handle = fopen("$source_file", "r")) !== FALSE) { $columns = fgetcsv($handle, $max_line_length, ","); foreach ($columns as $column) { $column = str_replace(".","",$column); } $insert_query_prefix = "INSERT INTO $target_table (".join(",",$columns).")\nVALUES"; while (($data = fgetcsv($handle, $max_line_length, ";")) !== FALSE) { while (count($data)<count($columns)) array_push($data, NULL); $query = "$insert_query_prefix (".join(",",quote_all_array($data)).");"; mysql_query($query); } fclose($handle); } } function quote_all_array($values) { foreach ($values as $key=>$value) if (is_array($value)) $values[$key] = quote_all_array($value); else $values[$key] = quote_all($value); return $values; } function quote_all($value) { if (is_null($value)) return "NULL"; $value = "'" . mysql_real_escape_string($value) . "'"; return $value; } } include('closedb.php'); echo "<br>done<br>"; ?> import java.util.Scanner; public class bijele { public static void main (String[] args) { Scanner in = new Scanner(System.in); int[] neededPieces = {1,1,2,2,2,8}; String[] currentPieces = in.nextLine().split(" "); for (int i = 0; i < 6; i++) { neededPieces[i] -= Integer.parseInt(currentPieces[i]); System.out.print("" + neededPieces[i] + " "); } } }
Is there a way I can readily stream-process a compressed XML file in PHP? Something like this NON WORKING example: Code: [Select] $reader = new XMLReader(); $reader->open(bzopen($planet_file,"r")); while ($reader->read()) { ... See also http://php.net/manual/en/xmlreader.open.php I am having my internship, and i was asked to automate the uploading of file and store the data to MySQL every 8:00am. i've read a lot of articles about crontab/cronjob/php:cron. but i am wondering what is a cron.php and what codes/scripts in that file. i also want to know what is .BAT for. do you have any steps and scripts for my problem? thanks alot.. I am trying to do two cron jobs: I have a program that is set to do a cron job every 15mins to check for imported list staged in the que. But I keep getting an error message:?? sh: line 1: /home/username/sitename.com/8/crons/processimports.php: Permission denied sh: line 2: : command not found this is what I have: Code: [Select] /usr/local/php5/bin/php -q /home/username/sitename.com/8/crons/processimports.php > /dev/null The second one is a scheduler to send out an email, but I get this error message: sh: line 1: /home/username/sitename.com/8/crons/scheduler.php: Permission denied from this out put: Code: [Select] /usr/local/php5/bin/php -q /home/username/sitename.com/8/crons/scheduler.php > /dev/nullPlease Help?? Thanks, TRUSTINWEB Is it possible to have a cron job merely by php ? not by OS (like linux cron). I mean having a php code to repeat a process on with a timer (e.g. every 5min). I'm trying to generate a cron job to run the below script, but can't get it to work for the life of me. Code: [Select] #!/usr/local/bin/php -q <?php if($_GET['key']=="a"){ // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT * FROM $tbl_name3 WHERE review_show='n'"; $result=mysql_query($sql); $num_results=mysql_num_rows($result); if($num_results > 0){ if($num_results==1){ $message="You have ".$num_results." review unapproved."; } else{ $message="You have ".$num_results." reviews unapproved."; } mail('webmaster@ghosthuntersportal.com','GHP Reviews', $message, 'From: sales@ghosthuntersportal.com'); } $sql2="SELECT * FROM $tbl_name4 WHERE rma_issued='n'"; $result2=mysql_query($sql2); $num_results2=mysql_num_rows($result2); if($num_results2 > 0){ if($num_results2==1){ $message="You have ".$num_results2." RMA Number Requested."; } else{ $message="You have ".$num_results2." RMA Numbers Requested."; } mail('webmaster@ghosthuntersportal.com','GHP RMA Number Requests', $message, 'From: sales@ghosthuntersportal.com'); } echo "Emails Sent."; } ?> Cron Job Command: Code: [Select] php -f /home/zyquo/public_html/ghosthuntersportal.com/cj_run.php?key=a I set the time to run every minute, just to try to get this to work... And in the end I get no emails in my inbox. |