PHP - External Links In Cronjob
Ok,
So I have a php script which I want to call using a cron job... It all works correctally when I call it from a browser, and I have updated the local paths to include the full url. All the local side of things works correctally/ fine. The issue is that during part of the script I am pulling an image from an external source (specifically Apple). I'm then using ImageMagik to convert it to a png and save the file locally. Again this all works outside of using a cron job, but dosen't when I am using a cron job... It's either an issue with the fact I'm using an external link, or an issue with utilizing ImageMagik... If it's a ImageMagik issue then I'll ask on their forums - but I first wanted to check there shouldn't be any issues with using external links in a php triggered by cron? Like it dosent try find the file at /usr/www/users/<external link here> or anything dumb like that? Cheers, - Adam G Similar Tutorials<html> <?php $id = $_GET['id']; $dbusername="web148-matt"; $dbpassword="matt"; $dbdatabase="web148-matt"; mysql_connect(localhost,$dbusername,$dbpassword); @mysql_select_db($dbdatabase) or die( "Unable to select database"); mysql_query("UPDATE count SET clicks=clicks+1 WHERE id='$id'"); $sql = mysql_query("SELECT link FROM count WHERE id='$id'"); $fetch = mysql_fetch_row($sql); $result = mysql_query("SELECT * FROM count"); while($row = mysql_fetch_array($result)) { echo "<a href=" .$row['link']. ">Link</a>"; } ?> <a href='http://www.google.com'>Google</a> <a href='/index.php?id=2'>link2</a> </html> Hi, I have a peice of code which publishes an image with a link from my database. However I cant get it to use external links. My code is: echo "<a href=\"" .$link . "\"> <img src=\"" .$image ."\" /> </a><BR />"; I have tried all the options I can think of but I cant get it work. Can anyone advise please? Hi, cd /var/www/html/googleplaystore-root-folder && php artisan schedule:run >> /dev/null 2>&1 This is the code developer gave me to add to the cronjob. and the location of my script is /home/vvkpexpj/public_html/example.com
Do i need to make any changes to the cronjob code he given.? i had copy pasted the code same as what he gave, but its not working Don't have a huge deal of experience with this side of things, well php as a whole really but really struggle with this side, ive coded up a cron but it only works for 1 user, unsure as to why, i want it to do the action for every player that has item 17, the codes below any help would be appreciated, Thanks guys Code: [Select] <?php include("server.php"); $sql = "SELECT * FROM player_inventory WHERE item_id = 17"; $que = mysql_query($sql) or die(mysql_error()); $res = mysql_fetch_array($que); $sql2 = "SELECT * FROM players WHERE id = $res[player_id]"; $que2 = mysql_query($sql2); while($res2=mysql_fetch_array($que2)) { $Weight = 8 / 100 * (100 + $res2['ProductionWeight']); $Quality = 75 / 100 * (100 + $res2['ProductionWeight']); $StreetCred = $Weight * $Quality / 10; $update = "UPDATE players SET StreetCred = StreetCred + $StreetCred WHERE id = $res[player_id]"; mysql_query($update) or die(mysql_error());; $update2 = "INSERT INTO drug_inventory (player_id,quality,weight) VALUES('$res[player_id]',$Quality,$Weight)"; mysql_query($update2) or die(mysql_error());; echo "Grow Completed."; } ?> Hi, I am using cpanel, where i am want to run a php file, to delete the old records, i used cronjob in cpanel to do this. In time columns i have made : * * * * * to execute each and every minute the script.. In the command textbox i have made: /home/server25/public_html/auto_cancel.php in the email box: admin_email@gmail.com I am getting Permission denied to my email address: The error report am getting is : /bin/sh: /home/server25/public_html/auto_cancel.php: Permission denied Please help me to solve this. Thanks, Hi there,
I want to make script which will execute via crontab every Sunday at 0:01h and will stop at 23:59h. My goal is to put(show) some tekst on the site. The problem is how to put this tekst in the site? I mean I know how to configure Cron Jobs but how to include the tekst in index.php for example?
crontab will be.
1 0 * * 0 /usr/bin/php Start.php 59 23 * * 0 /usr/bin/php Stop.php I have a script that fetch emails and its work file when I call it through SSH with PHP at the beginning on the path when I added a cronjob it was working fine too... the problem start when I disable the cronjob email response, the script dose not functioning with Imap What can I do in order to bypass this problem, I will try to call it with include but I have no other options.. Please help My host has a limit of 100 emails per hour and this is now being reached to many times a day and some emails are not being sent due to this. Does anyone have a script or know of one that can stack emails to be sent in MySql or something and every 5 minutes send one out from the stack and then delete from the stack the ones sent. So I have been working on my website for a while which all is php&mysql based, now working on the social networking part building in similar functions like Facebook has. I encountered a difficulty with getting information back from a link. I've checked several sources how it is possible, with title 'Facebook Like URL data Extract Using jQuery PHP and Ajax' was the most popular answer, I get the scripts but all of these scripts work with html links only. My site all with php extensions and copy&paste my site links into these demos do not return anything . I checked the code and all of them using file_get_contents(), parsing through the html file so if i pass 'filename.php' it returns nothing supposing that php has not processed yet and the function gets the content of the php script with no data of course. So my question is that how it is possible to extract data from a link with php extension (on Facebook it works) or how to get php file executed for file_get_contents() to get back the html?
here is the link with code&demo iamusing: http://www.sanwebe.c...-php-and-jquery
thanks in advance.
I would like a part of my script to link to an external sites script It doesn't seem to be doing it though Othersite.com - index.php?name=hello&status=1 I would like my post.php to run that above. Can it be done? Hi all,
So im trying to improve on my PHP as my knowledge isn't that great.
lets say for argument sake my ip is:
192.168.0.1
im trying to set a external variable to set this as the url.
so on each page i use, for each link instead of typing out the ip address i can simply type:
<a href="{url}/index.php">Home</a>
and then if it is possible, to do something like this:
<link rel="stylesheet" href="{url}/main.css" type="text/css">
all in one file so in my php pages i can simple include 1 php file and it will have all of the relevant stylesheets ect linked to it.
Edited by srwright, 30 May 2014 - 01:18 PM. I'm building a program in php that will be able to view YouTube videos from the URL. So if I type: http://www.youtube.com/watch?v=(Video ID) Then my program works and it will return the Video ID! But then some idiot clicks on a related video and this URL is generated: http://www.youtube.com/watch?v=(Video ID)&feature=related And my program strips the first bit by replacing "http://www.youtube.com/watch?v=" with an empty string "" but then I'm still left with the "&feature=related" I thought about just replacing that with an empty string as well but sometimes there can be a URL like this: &feature=g-vrec&context=G28d9eecRVAAAAAAAABA Which has a different unique code each time. So I thought it'd be much simpler if I could use $_GET[] with an external URL, so the user types in: http://www.youtube.com/watch?v=(Video ID)&feature=related It just gets the "v" value rather than my buggy replace thing. Thanks. I was just wondering if it was possible to have an external php file that can be included in the head of a web page, like a .js file. If this isn't possible maybe have a .js file containing php code that can be executed regarding the JavaScript around it... I know basically nothing about PHP but i have a few websites i manage that are built with PHP. I plan to learn PHP but for the time being learning Javascript has a wider range of usability for me. That being said, Im trying to link to an XML sitemap using php. in html i would use Code: [Select] <link href="sitemap.xml" /> how can i do this in PHP? I have searched google and such for how to do this but was unable to find an explanation that i could understand as relating to my need. Hello Everyone! I'm new to the forum and new to PHP. I'm curious about the limitations of PHP. I'm working a project that I'm not even sure is possible in PHP. The project is simple: I need a page that can track business reviews on external sites and report that activity to a database. Below is a simple mockup of the html. Code: [Select] <html> <head> <title>Boomerang Project</title> </head> <body> <h1>Like Our Work?</h1> <h2>Help Spread The Word.</h2> <p>Click on the links below to start writing a review about the service that we have provided you.</p> <h3>Complete 5 reviews recieve a gift certificate.</h3> <ul> <li><a href="" target="_blank">Yahoo</a></a></li> <li><a href="" target="_blank">Google</a></li> <li><a href="" target="_blank">Yelp</a></li> <li><a href="" target="_blank">Manta</a></li> <p>You have completed <!--Number-of-Reviews-Completed-->. <br /> <br /> <!--The form below doesn't appear until at least 5 reviews are confirmed to have been posted. At which point a script will reconfirm the postings and send 2 emails, one to business with client info and another email to client confirming the completion of the postings.--> <form> <fieldset> <label for="name">Name</label><input type="text" name="full-name" /><br /> <label for="address">Address</label><input type="text" name="address" /><br /> <label for="city">City</label><input type="text" name="city" /><br /> <label for="state">State</label><input type="text" name="state" /><br /> <label for="zipcode">Zip Code</label><input type="text" name="zipcode" /><br /> <label for="telephone">Telephone</label><input type="text" name="telephone" /><br /> <label for="email">Email</label><input type="text" name="emaile" /><br /> <input type="submit" /> </fieldset> </form> </body> </html> What is the best way to load a .jsp file on an external sever? Hi all, Im just wondering how you go about building a search function to another website, So on my webpage i could have a search that searchs the itunes store or something? Has anybody previous experience with this or can point me in the right direction, I have googled this but all im being shown is an overwhelming amount of results for google instant! thanks in advance Hey, I have written an external login script for my PHPBB3 forums but I am having trouble writing the script to allow the user to register and have their information added into the table phpbb_users which stores the phpbb account details. I have tried some code and written my own but I cannot seem to get it to input the data into the tables. Has anyone written a script for this or know of a place that I can learn how to do it??? Regards, Mathew Hood Ok, I would just like some advice on how to go about doing something. A website that alot of my friends use to make their builds in-game goes down frequently causing them not to be able to pull up their build information. I would like to be able to use php to copy not only the html source, but the images as well to my websvr to be able to view when their site is offline. Now I know I could simply just click page -> save as complete html in internet explorer and then upload that... However I don't want to have to do that for everyone stuff.. its time consuming.. I was hoping to automate the process with a script. I know how to get the html source from a website, but I don't know how to pull the content "pictures ect." to make it actually look like their site and have more than just text. I'll appreciate any advice you can give, I think some simple direction should be enough to get me going. hi, I am building a web app and need all my php on one page and links posting to same page etc, at the moment, I am linking to my townpubs.php page see code below: townpubs.php Code: [Select] <!doctype html> <?php include "../config.php"; $loggedIn = (isset($_COOKIE['loggedin']) && $_COOKIE['loggedin'] == 'true')?true:false; $town = $_REQUEST['RSTOWN']; $towns = mysql_query("SELECT * FROM pubs WHERE RSTOWN = '".$town."' ORDER BY RSTOWN ASC"); ?> <html> <head> <meta charset="UTF-8" /> <title>My Pub Space v1.0 β</title> <style type="text/css" media="screen">@import "jqtouch/jqtouch.min.css";</style> <style type="text/css" media="screen">@import "themes/jqt/theme.min.css";</style> <script src="jqtouch/jquery.1.3.2.min.js" type="text/javascript" charset="utf-8"></script> <script src="jqtouch/jqtouch.min.js" type="application/x-javascript" charset="utf-8"></script> <script type="text/javascript" charset="utf-8"> var jQT = new $.jQTouch({ icon: 'jqtouch.png', addGlossToIcon: false, startupScreen: 'jqt_startup.png', statusBar: 'black', preloadImages: [ 'themes/jqt/img/back_button.png', 'themes/jqt/img/back_button_clicked.png', 'themes/jqt/img/button_clicked.png', 'themes/jqt/img/grayButton.png', 'themes/jqt/img/whiteButton.png', 'themes/jqt/img/loading.gif' ] }); </script> </head> <body> <!-- TOWNS --> <div id="towns" class="current"> <div class="toolbar"> <h1>View Pubs</h1> <a class="back" href="index.php" rel="external">Home</a> </div> <h2>Pubs in <?php echo $town ?></h2> <ul class="plastic"> <?php while($row1 = mysql_fetch_array($towns)) { echo '<li class="arrow"><a href="pubinfo.php?PUBID='.$row1['PUBID'].'" rel="external">'.$row1['rsPubName'].'</a></li>'; } ?> </ul> </div> </body> </html> I would like to have this on my index.php page: index.php Code: [Select] <!doctype html> <?php include "../config.php"; $loggedIn = (isset($_COOKIE['loggedin']) && $_COOKIE['loggedin'] == 'true')?true:false; $query1 = "SELECT DISTINCT rsTown FROM pubs ORDER BY rsTown asc"; $result = mysql_query($query1); $towns = mysql_query("SELECT DISTINCT RSTOWN, COUNT(PUBID) As PubCount FROM pubs GROUP BY RSTOWN ORDER BY RSTOWN ASC"); $counties = mysql_query("SELECT DISTINCT RSCOUNTY, COUNT(PUBID) As PubCount1 FROM pubs GROUP BY RSCOUNTY ORDER BY RSCOUNTY ASC"); if ($loggedin == 'true'){ $locals = mysql_query("SELECT * FROM pubs INNER JOIN favepub_copy ON pubs.PUBID=favepub_copy.PUBID WHERE USERID='".$_SESSION['USERID']."' ORDER BY rsPubName asc"); } ?> <html> <head> <meta charset="UTF-8" /> <title>My Pub Space v1.0 β</title> <style type="text/css" media="screen">@import "jqtouch/jqtouch.min.css";</style> <style type="text/css" media="screen">@import "themes/jqt/theme.min.css";</style> <script src="jqtouch/jquery.1.3.2.min.js" type="text/javascript" charset="utf-8"></script> <script src="jqtouch/jqtouch.min.js" type="application/x-javascript" charset="utf-8"></script> <script type="text/javascript" charset="utf-8"> var jQT = new $.jQTouch({ icon: 'jqtouch.png', addGlossToIcon: false, startupScreen: 'jqt_startup.png', statusBar: 'black', preloadImages: [ 'themes/jqt/img/back_button.png', 'themes/jqt/img/back_button_clicked.png', 'themes/jqt/img/button_clicked.png', 'themes/jqt/img/grayButton.png', 'themes/jqt/img/whiteButton.png', 'themes/jqt/img/loading.gif' ] }); </script> </head> <body> <div id="about" class="selectable"> <p><img src="jqtouch.png" /></p> <p><strong>My Pub Space</strong><br />Version 1.0 beta<br /> <a href="http://www.jbiddulph.com" target="_blank">By John Biddulph</a></p> <p><em>Mobile Web Development</em></p> <p><a href="mailto:john.mbiddulph@gmail.com" target="_blank">E-mail</a></p> <p><a href="http://twitter.com/#!/jmbiddulph" target="_blank">@jmbiddulph on Twitter</a></p> <p><br /><br /><a href="#" class="grayButton goback">Close</a></p> </div> <div id="home" class="current"> <?php if (!$loggedIn){ ?> <div class="toolbar"> <h1>My Pub Space</h1> <a href="#about" id="infoButton" class="button slideup">About</a> </div> <ul class="rounded"> <li class="forward"><a href="#signup">Register an account</a></li> <li class="forward"><a href="#login">Login</a></li> <li class="forward"><a href="#towns">View pubs by town</a></li> <li class="forward"><a href="#counties">View pubs by county</a></li> </ul> <div class="info"> <p>All Rights Reserved © 2011 mypubspace.com Created by: jbiddulph.com</p> </div> <?php } else { ?> <div class="toolbar"> <h1>Hi <?php echo $_SESSION['s_username'];?></h1> <a href="dologoff.php" rel="external" class="button">Logout</a> </div> <ul class="rounded"> <li class="forward"><a href="#locals">View Locals</a></li> <li class="forward"><a href="#towns">View Towns</a></li> <li class="forward"><a href="#counties">View Counties</a></li> </ul> <div class="info"> <p>All Rights Reserved © 2011 mypubspace.com Created by: jbiddulph.com</p> </div> <?php } ?> </div> <!-- LOCALS --> <div id="locals"> <div class="toolbar"> <h1>My Locals</h1> <a class="back" href="#home">Back</a> </div> <ul class="plastic"> <?php while($row1 = mysql_fetch_array($locals)) { echo '<li class="arrow"><a href="pubinfo.php?PUBID='.$row1['PUBID'].'" rel="external">'.$row1['rsPubName'].', '.$row1['rsTown'].'</a></li>'; } ?> </ul> </div> <!-- TOWNS --> <div id="towns"> <div class="toolbar"> <h1>View Towns</h1> <a class="back" href="#home">Back</a> </div> <ul class="edgetoedge"> <?php $ltr = ''; while($row1 = mysql_fetch_array($towns)) { $letter1 = substr($row1['RSTOWN'],0,1); if ($letter1 != $ltr) { print'<li class="sep">'. $letter1 .'</li>'; } $ltr = $letter1; echo '<li class="forward"><a href="townpubs.php?RSTOWN='.$row1['RSTOWN'].'" rel="external">'.$row1['RSTOWN'].'<small class="listcounter">'.$row1['PubCount'].'</small></a></li>'; } ?> </ul> </div> <!-- COUNTIES --> <div id="counties"> <div class="toolbar"> <h1>View Counties</h1> <a class="back" href="#home">Back</a> </div> <ul class="edgetoedge"> <?php $ltr = ''; while($row1 = mysql_fetch_array($counties)) { $letter1 = substr($row1['RSCOUNTY'],0,1); if ($letter1 != $ltr) { print'<li class="sep">'. $letter1 .'</li>'; } $ltr = $letter1; echo '<li class="forward"><a href="countypubs.php?RSCOUNTY='.$row1['RSCOUNTY'].'" rel="external">'.$row1['RSCOUNTY'].'<small class="listcounter">'.$row1['PubCount1'].'</small></a></li>'; } ?> </ul> </div> <form id="login" action="dologin.php" method="POST" class="form"> <div class="toolbar"> <h1>Login</h1> <a class="back" href="#">Back</a> </div> <ul class="rounded"> <li><input type="text" name="rsUser" value="" placeholder="Username" /></li> <li><input type="Password" name="rsPass" value="" placeholder="Password" /></li> </ul> <a style="margin:0 10px;color:rgba(0,0,0,.9)" href="#" class="submit whiteButton">Submit</a> </form> <form id="signup" action="dosignup.php" method="POST" class="form"> <div class="toolbar"> <h1>Sign up</h1> <a class="back" href="#">Back</a> </div> <ul class="rounded"> <li><select name="RSTOWN" class="postcodedrop"> <option value="">Choose your Town...</option> <?PHP while($row = mysql_fetch_array($result)) { echo '<option value="'.$row['rsTown'].'">'; echo $row['rsTown']; echo '</option>'; }?> </select></li> <li><input name="RSUSER" type="text" class="textbox" id="RSUSER" value="" placeholder="Username" /></li> <li><input type="Password" name="RSPASS" value="" placeholder="Password" /></li> <li>Male <input name="RSGENDER" type="radio" value="Male" /> Female <input name="rsGender" type="radio" value="Female" /></li> <li><input name="RSEMAIL" type="text" class="textbox" id="rsEmail" placeholder="Email" /></li> <li><input name="RSMOBILE" type="text" class="textbox" id="rsMobile" placeholder="Mobile No." /></li> <li><input name="RSAGE" type="text" class="textbox" id="datepicker" placeholder="DOB: dd/mm/yyyy" /></li> </ul> <a style="margin:0 10px;color:rgba(0,0,0,.9)" href="#" class="submit whiteButton">Submit</a> </form> </body> </html> I need to set empty variables at the top and link page to itself?! |