Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Use PHP To Delete An External File?


Is there any way to use PHP to delete an external file?




View Complete Forum Thread with Replies

Related Forum Messages:
Delete String In External File
I must: open a file, keep out a string and delete it.

View Replies !
External PDF File
Is there a way for me to be able to fetch a PDF from another site and display it on my website without having to open up Adobe Reader?

In other words, I would like to have this PDF document: http://flightaware.com/resources/airport/ASE/APD/AIRPORT+DIAGRAM/pdf

to be displayed on a page when a user opens a page on my website.

View Replies !
Url In An External Php File
Situation: I have an external php file with a function in it that returns a value with document.write like this:

<?php
Header("content-type: application/x-javascript");

function myfunction()
{
return $something;
}

$some_variable=$something;

echo "document.write("Some_Text: " . $some_variable . "")";
?>

When called remotely by javaScript, the php function behaves perfectly returning the desired variable:

<script> type="text/javascript" src="http://www.mydomain.com/remote.php"></script>

The Problem:

I would like to display the "Some_text:" part with an active link as in
<a href="http://www.yourdomain.com/">Some_text</a>

So that when executed, the JavaScript displays the link with an anchor text. How can I write this code into the echo document.write function?

View Replies !
Calling External File
I am fairly new to PHP programming, and I'm trying to get my head around
this one...

I have a form that I am doing validation on via PHP within the same page, so
if there is an error, a message will show to the user above the form. If all
goes well, I would like to call a processing script that I have already set
up and working to format the users response and send it out to a specified
e-mail... I'll call it processing.php

Is there a way that I can, if the form is filled out correctly, make a call
to processing.php, that will totally leave the control of form.php and do
it's processing?

View Replies !
Including External File
I have two sites that I am trying to get to "talk" to each other.

I have one site that contains a PHP file that basically outputs an XML formatted list depending on the file structure in that directory.

The other site needs this XML formatted data to complete the PHP generated XML file that I am trying to put together. (Much like syndicating my content from one site to another)

I have tried using readfile, include and header(Location:) and none of them seem to be working. What I need is for the calling file to somehow include the output of the remote file. (The same stuff you see if you view the source) What happens is that I can 'readfile' my index page on that site, but not the one that puts out the XML data that I need. Could it be that the XML file doesn't actually create any visual content on the page? or doesn't have 'head' and 'body' tags?

It would be great if I could do all of this in PHP so that the final source would not include anything that would disrupt the final XML output.

View Replies !
Open External File
Is it possible (how?) to open a file that is located on another server? I need to open the file so that I get the HTML code (so that I can parse information form it).

View Replies !
External Text File
I have several thousand zip files, and I want to make a text file that has the links to the files. How would I be able to do that. Just to let you know about how many files I'm going to be working with, around 7,000+. It needs to work with html files also, I have 200+ .swf files I need to link also. I have never used php, or even looked at it until July, 05, make that I never heard of it until July, 05 .

How would I set up the text file to make it work with php file? and How would I set up the php file to make it work with the text file? The text files will be in the same directory with the zip, swf, so I should be able to use relative links right? I think it is relative the code that has the <a href="thisfile.zip">This File</a>.

View Replies !
Writing To External File
I noticed that in order for me to be able to write output to external file, I must have that file CHMOD 0777.

Now, this file will have static html in it to be used as include. Question, how bad of a security risk is it to leave static HTML page with 0777 permissions. There is no direct link to that file otherwise.

I tried to see if I can CHMOD the file to 0777 using PHP, write my output and then CHMOD it back to 0644, but it doesn't seem to work. I suppose my server settings do not permit it.

View Replies !
Get Contents Of External File
I Need To Get The COntents Of An External File And Put It In A Text Box

Eg Say If The External File Was This

<?php

echo 'Simple Example'

?>

Then The Page With The TextBox Looks Like This

<textarea><?php

echo 'Simple Example'

?></textarea>

View Replies !
Str_replace() External File
I have this page (print.php). In that file, I want to to include a text
file from "songs/breathe.txt", and replace all instances of "<b" with
"<span" and "</b>" with "</span>". I know how I should use str_replace
and I tried to do this:

<?php

$replace_a=str_replace("<span","<b",include("text/breathe.txt"));
$replace_b=str_replace("</span>",</b>",$replace_a);

?>

but it doesn't work.

View Replies !
Reading An External File
I'm trying to get a value from a link from an external source. I can return the whole page using the following: PHP Code:

file_get_contents("http://www.example.com/the_file.asp") .....

View Replies !
Execute External Binary File With PHP
I have a problem.I wanna run binery using php, but i cant.
chk this out:

<?php
$com=("gcc -o new new.c");
system($com);
?>

Note:I'm using Fedora-7,Apache2,PHP-5.1.1 and i was logged on as root.
i used exec() function too btu it also fail.

View Replies !
Using External File While Allow Url Fopen Is Disabled
does anyone know if theres a way to grab an external file if allow_url_fopen is disabled. the alternative should be cURL,but thats not enabled to... any other solutions?

View Replies !
Calling External Php File Before <html> Tag
just wondering if it is possible to call a function that resides on
external php file before any <html> tag?? i have a code that sets a
cookie which needs to be called before <html> tag. If I use that code
on the same file, it works fine. But I'd like to use it on a separate
php file so that it'd be easier to modify in the future because that
same function can be called from other files too... When I include the
external php file in my main file, it gives me warning saying
something like the cookie is set by the external file.... Is there a
way to do it properly?

View Replies !
Using Php To Execute External File ( System() )
I am using PHP to execute an external program using system().  Using system() though I found that PHP will remain in memory until the external program ends.

Is there a way to call an external program with PHP and have PHP exit before the external program exits?

View Replies !
Connect To An External Site Via A Php File?
I have tried this multiple ways and google searched my but off. I know this can be done. Anyone know how?

View Replies !
Posting Array To An External Php File
I do use JPGraph for ploting some data. I compute the data and generate to sets of DATA.
$X and $Y. I have also written a plot.php file where run my plot.

What I want to do is something like below? Dos anyone know it is possible? Cause I cannot post the Array values. <img src=plot.php?X=$X&Y=$Y> The plot.php sends the header as a PNG file and generate the plot.

View Replies !
Write To A File On An External Computer?
Is it possible for me to write to a file on an external computer? I am building a site where i want the users to be given an unik id the first time they contact the site through a piece of software which i have developed. Their username is found in a settings file on their local harddrive and is sent to the server when they request infromation from the server. Now i want to be able to change the string in the settings file so that after the first request to the server it will contain their unik id as well.
Is this possible?

View Replies !
A Variable Equal To An External TXT File...
I'm Learning PHP and I would like to know if there's a way to set a variable to an external txt file. If this possible? How can I accomplish this?

View Replies !
Check If External File Exists
I'm trying to add favicons for external links on my site and I'd like to serve up a default image of my own if one doesn't exist. I've seen a javascript solution out there but I'd rather work this out in php. Here's what I have that's working:

$urlbits = parse_url($array['url']);
$favicon = "http://". $urlbits['host'] ."/favicon.ico";
if (!@fclose(@fopen($favicon, "r"))) {
$favicon = "/dev/images/favicondefault.gif";
}

The problem is that the script is incredibly slow as it waits for every single server in the list (typically 15 or so) to respond. If I just go ahead and print the page then the available favicons display as they load but then I can't substitute in a default favicon if one doesn't exist. So, my question is, is there a better script for what I'm doing or a way to adjust the timeout for my current script so that a slow external server doesn't cause it to hang?

View Replies !
Write An External File To Put An Array Into It
I need to write an external file and I need to put an array into it. I create a portion of the file like this:

PHP Code:

ob_start();

echo '<?
$externalArray = '.$myArrayValues.'
?>'

$myVar = ob_get_clean();

$newArray = '. print_r(myExternalFile.php) .'

View Replies !
Calling External File Do It's Processing?
I have a form that I am doing validation on via PHP within the same page
(form.php), so if there is an error, a message will show to the user above
the form. If all goes well, I would like to call a processing script that I
have already set up and working to format the users response and send it out
to a specified e-mail... I'll call it processing.php

Is there a way that I can, if the form is filled out correctly, make a call
to processing.php, that will totally leave control of form.php and do it's
processing?

View Replies !
Keeping External File Structure
I was curious if it is possible to create a file with a structure and then read it with php and display it like it is saved.What is the best text format to use for this purpose.

View Replies !
How I Can Avoid External Access To A File
Linux server. I want to avoid external access to a xml file (named file.xml ie) into a directory (named xml ie). In the same time I want to permit access (rwx) to the script.

I tried with:

xml 0700
file.xml 0700
owner webserver
I've got access to the file.xml file.

xml 0200
file.xml 0200
owner webserver
the script doesn't work.

View Replies !
Include External File In Table
Basically, I have a static html page with tables, graphics, etc. I am trying to include an external php file (namely, bazookaboard forum) which held in a seperate folder on my server, into the main table in my page.

I have tried saving my static page as php and putting in a simple include tag to point to the index.php of the bazookaboard, but always get an error:

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at .......

I think I am doing something wrong, but don't know what. Of course I can add an iframe to the table which contains the index.php for the message board script, but would rather use the php method.

View Replies !
Download File And Delete File From Server With One Button Click
I want the user to be able to download a CSV file and delete the file from the server all with the click of a button.  Currently, in firefox, it will just display the CSV and not delete it. In IE, it will download the CSV and not delete it. Code:

View Replies !
Replaceing A Value Within An External Settings Text File.
im in the process of creating a method to allow the user to change the config file currently in use. i have created an html form with a dropdown menu, which passes the filename of the new config file forward to the action page. Code:

View Replies !
Fopen And Read An Xml File From External Webpages
Im in the middle of creating a flash movie with various movie clips loading variables from a php file. The problem lies when i try and fopen and read an xml file from external webpages Code:

View Replies !
Including External Php File And Executing A Command
I have two different servers, and i need to call a php of server B from server A, so i did this:

SERVER A:

index.php has:
include('http://server-b/file.php');

The content of file.php is:
phpinfo();

... but phpinfo() throws info about server B instead of its parent file SERVER A.

View Replies !
Loading External HTML File In Every Page
how can I load a HTML into my "every-page" template. Let's say I have a menu (HTML - ul list that becomes a collapsing menu thru CSS) and I want to have it loaded in every page of my site.

View Replies !
Simple Counter With External Text File
I'm starting with PHP and I need to do a simple counter. When I visit a page, I need to add "1" to a $counter and save it the new value in the external text file.

View Replies !
How Do You Link To An External PHP Script In An HTML File?
I installed XAMPP, so everything should be configured properly. However, I'm still having problems. So, here are some of the questions I have. If anyone could help me out on any of them, that would be great.

1. What is a web server? How is it helping me write PHP?

2. When I open my PHP files in my browser, they are still not read properly. Any known reason why?

3. How do you link to an external PHP script in an HTML file? Is there a such thing, or am I totally clueless?

View Replies !
Calling Code From External File Like Javascript?
placing php code in an external file, and then link to it? id like to do this to avoid too much code in my pages:

for javascript the following solution exists:
<script type="text/javascript" src="images.js">

View Replies !
PHP Variables Inside External JavaScript File (workaround?)
I have been trying to really separate JavaScript from HTML/PHP, just like with CSS. My problem, is that I am having problems passing a PHP variable or making use of it through an external JS file. If I was using inline JS I could pass it like:

<a href="bla.php" onclick=return confirm("Delete this item: <?php echo $item ?>")> Delete (works) </a>

However, using similar code in an external JS file, simply passes through as text. Is there any way to accomplish something similar?

The new code is much nicer: <a href="bla.php" class="delete"> Delete (doesn't quite work) </a> IS there a way to keep code this clean and properly separate the JS from the HTML while at the same time keeping the PHP $variable working?

I am well aware that JS runs on the client, and PHP on the server, I am just hoping to somehow pass this variable through some work around, if not I will keep using the inline version.

View Replies !
What Is The Best Way To Delete File ...?
I have script that allows a user to upload a txt file for processing, filtering, to save bandwidth,instead of user reuploading the file everytime he/she does a new process on the same file, i save the file to the server, and process from that file. What I want to be able to do is, when the user uploads a new file, or leaves the site, this temp file is automatically deleted (saves disk space).

View Replies !
Delete File();
I was wondering if php4 has a built in function that could delete a file. In my case I need my php to delete a picture. (jpg, gif) Does php4 have the ability to delete an exsiting file? Something like this?? delete_image("../images/somePic.jpg");

View Replies !
Delete A File
How do i delete a file from my server with php?

View Replies !
Delete File
How do I delete a file with PHP?

View Replies !
Delete File With Php
Im a little new in php, and just made a site where u can upload pictures, but how can i make it possible to delete pictures as well.

View Replies !
File Delete
I need to delete a compressed backup file after it has been sucessfully uploaded to a ftp server, the upload works fine using CRON and a php page. I have tried to delete the file using:

<?
$oldfile = "/home/#*$!/backup-10.8.2005_07-00-01_yyy.tar.gz";
unlink($oldfile);
?>

However I get a permission denied, what's wrong? Also, I don't know the exact file name, so what I really want to do is wildcard the file name like this:

<?
$oldfile = "/home/xxx/backup-*_yyy.tar.gz";
unlink($oldfile);
?>

Is this possible?

View Replies !
Using Php To Delete A File In A Directory- Help
I can use php to execute the cp command to copy an image file into a directory.

Now I want to delete images in that directory if they are not named "picturelink.gif" when an entry with a corresponding id is deleted.

Below is the code I am using which doesn't seem to be working when it comes to deleteing the file. The directory has the correct permissions for read/write access.

$query = "DELETE FROM $userstable WHERE id ='$id' ";

if($picture != "picturelink.gif")
{
exec("rm $picture /virtualhosts/capefearantiques.com/www/pictures/$picture");
}

View Replies !
Delete Lines From File:
How to delete $n first lines from $str if i know how much lines shuld remain in the string?

$str = "aaaaaaaaa
bbbbbbbb
ccccccccc
ddddddddd
...
zzz";

Can it be done easly with preg_replace? (i.e without splitting it by '', removing elements from array and joining tham back.

View Replies !
How Do You Delete A File From A Listing Please?
I have the code:

<?php
if ($dir = @opendir("../project/proj_images")) {
while (($file = readdir($dir)) !== false)
if($file != ".." && $file != ".")
echo "<tr><td align="left" class="bodyblue2">$file</td></tr>";
closedir($dir);
}
?>

which displays a list of files in a directory.

What I want, is to be able to click on a file in the list and delete it.

I know you use unlink but how do you tie it in with the above code?

View Replies !
Can I Delete A File From A PHP Script?
Is it possible to delete a file(a jpg in fact) from a PHP script. I would like to ad this functionality to an existing script that deletes a record from a MySQL db. Only the image name is stored in the db.

View Replies !
Trying To Delete A File Using Unlink
i am trying to delete a file using the unlink function but it just is not working. i just get the Could not delete message. Is there anyway to find out exactly what is wrong? I've tried the exact path which is C:/domain/wwwroot/temp/0000000.txt but it just does not delete. Also i dont think it can be related to permissions because the 0000000.txt was created automatically by a script. The code i used is as follows:

<?
$delete = unlink("C:/domain/wwwroot/temp/0000000.txt");

if($delete)
{
echo "Succesfully Deleted";
}
else
{
echo "Could not Delete";
}
?>

View Replies !
Php File Delete Form
How would i go about making a file delete form in php. so that the user can delete .jpg and .gif files from a web directory.

View Replies !
How To Delete Last Line Of File
I have a flat file on the server which I append to from a HTML web form.
I need to delete the last line of the flat file before I append though.

How do i do that?

I have the following code. I'm not sure if it's correct.

$pattern = "</member>"; // what I want to look for.
$ora_books = preg_grep($pattern, file('/path/to/your/file.txt'));

View Replies !
How Can I Have Permissions To Delete A File?
How can I have permissions to delete a file? example: I have to delete a file, but I don't to public users have permission to delete that file but, with a certain "login" they can.

View Replies !
Delete Lines From A File
Can someone show how I open a file and delete everything in it except for the last 20 lines.

View Replies !
How To Delete N Lines From The Top Of A File?
I'm not sure how to do this in php - need to calculate and delete an unspecified
number of lines from the *top* of a file.

<?php
//append $visitor to the bottom of $visdata
$fp = fopen($visdata,"a");
fwrite($fp, "
".$visitor;)
//count the lines in $visdata
$lines = count($visdata);
if $lines > 10
{
//delete as many lines off the top as necessary
//to end up with 10 lines total in $visdata
}
fclose($fp);
?>

View Replies !
How To Delete Log File In The Given Period
I dont have much knowledge og PHP. i need to delete log files in the given period. so i need to know how to delete file content using php. i know how to read file content. but i dont know how to delete file content.

View Replies !
Delete File Contents
Can someone post some code to show me how to delete a file from a folder please? I need to delete a file first, and then upload something in it's place. Maybe a bit of code to slide in what i have already would work? Code:

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved