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.





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 Complete Forum Thread with Replies
Sponsored Links:

Related Messages:
Reading Data From COM Port (by Using External DLL)
If I have DLL file that give me ability to read data from COM port… Can I link PHP server to it, and then use the classes from that DLL to read data from COM port through web interface? (Something like extended system(); )

View Replies !   View Related
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 !   View Related
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 !   View Related
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 !   View Related
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 !   View Related
Use PHP To Delete An External File?
Is there any way to use PHP to delete an external file?

View Replies !   View Related
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 !   View Related
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 !   View Related
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 !   View Related
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 !   View Related
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 !   View Related
Delete String In External File
I must: open a file, keep out a string and delete it.

View Replies !   View Related
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 !   View Related
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 !   View Related
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 !   View Related
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 !   View Related
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 !   View Related
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 !   View Related
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 !   View Related
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 !   View Related
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 !   View Related
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 !   View Related
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 !   View Related
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 !   View Related
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 !   View Related
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 !   View Related
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 !   View Related
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 !   View Related
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 !   View Related
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 !   View Related
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 !   View Related
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 !   View Related
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 !   View Related
File Locking / File_get_contents() / File Changed While Reading?
I'm using file_get_contents() to get the contents of a file, *BUT* I need to be sure that the file doesn't change while file_get_contents() is reading the contents of the file.

I'm not sure if file_get_contents() will ensure that the file contents don't get changed ( another script fwrites() to the file ) while file_get_contents() is doing its thing, or if I need to use a lock file to ensure this doesn't happen.


Anyone know if I need to use a lock file, or will I be fine just calling file_get_contents()?

View Replies !   View Related
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 !   View Related
Reading A File - Open A File Just Copied
For some reason I can open a file, but I can't read it (I checked with is_readable() and is_writeable() and both returned true). I'm trying to open a file just copied, so maybe that's the reason why I can't read it, and I would have to reload the page. PHP Code:

View Replies !   View Related
HTTP File Reading HTTPS File
I need a way to read https php file that returns me a xml data. I must read from a http php file. These two files are on diffrent domains and a https php file uses openssl. Has anyone tried or done to do such thing? I assume I have a problem because these two files are not on same domain or these two files could be on a diffrent domains if certificate would be paid - verified.

View Replies !   View Related
Reading Tar.z File
i wanna extract and read data from a tar file i have tried www.phpclasses.org/browse/package/529.html thing. but that is not working for .z file. any idea how to do that ?

View Replies !   View Related
Reading A File
I've got the following script:

<?
$inhoud = file("/opt/scripts/sc/sc_trans.log");
$inhoud = implode("", $inhoud);

$inhoud_array = explode("
", $inhoud);

for($i=0; $i < count($inhoud_array); $i++){
$titel1 = explode("[DECODE] Opened ",$inhoud_array[$i]);
$titel2 = explode(".mp3",$titel1[1]);
$titel = $titel2[0];

$part1 = explode("<",$inhoud_array[$i]);
$part2 = explode(">",$part1[1]);
$tijd= $part2[0];
$tijd= ereg_replace("@"," ", $part2[0]);

echo "[$tijd] $titel
";
}
?>

While running this I get:

PHP Notice: Undefined offset: 1 in /opt/scripts/shoutcast/crphp on
line 9

How do I solve this?

View Replies !   View Related
Reading A .txt-file With Php
I have the following problem and it would be nice, if someone could help
me out on this problem:

content of file.txt

#1: Michael
#2: Dennis
#3: Karl

the following file writes only the first line of file.txt:

<?php
$fp = fopen("file.txt","r");
if ($fp)
{
$line = fgets($fp, 100);
echo "$line<br><br>";
fclose($fp);
}
?>

Now I would like to have a PHP-file, which can write every line in
different orders (the order should be write in the PHP-file)

for example:

#2: Dennis
#1: Michael
#3: Karl

View Replies !   View Related
Reading A M3u File
I'm trying to read a .m3u file.. I'm almost done but got one problem.. I'm trying to remove every non related info for the song info.. meaning the #EXTINF: etc... I've managed to strip the #EXTINF but the problem comes to removing the number after that... Code:

View Replies !   View Related
Not Reading Whole File
I have the following code after uploading a csv (text) file:

   $file = fopen($_FILES['theFile']['tmp_name'], 'rb') or die("Can't open file");
   $theData = fread($file,filesize($_FILES['theFile']['tmp_name']));
   fclose($file);

   $delimiter = "
";
   $splitcontents = explode($delimiter, $theData);

for whatever reason, its not reading more than two lines.. it has about 12,000 lines in it, and needs to be split by the " " then I loop through that array and split it by the "," its only reading the first 2 lines. what am I doing wrong?

View Replies !   View Related
Not Reading The Php.ini File
I have php 4.3.3 on my local IIS5.1 server (XP) in ISAPI mode. It all works ok except that it does not seem to be reading the php.ini file as any changes I make are not shown up when doing a phpinfo(). This shows the ini path as c:windowsphp.ini. This is where it is and it is the only php.ini
on the machine. I have tried stopping and starting the service but this does not help.

View Replies !   View Related
File Reading
<a href="http://localhost/Ad/img_1.jpg" target="_top" >
<img src="Ad/img_1.jpg" width="468" height="80" border="0">
</a>
~
<a href="http://localhost/Ad/img_2.jpg" target="_top" >
<img src="Ad/img_2.jpg" width="468" height="80" border="0">
</a>
~
<a href="http://localhost/Ad/img_3.jpg" target="_top" >
<img src="Ad/img_3.jpg" width="468" height="80" border="0">
</a>


how can i extract "href" & "src" elements from the text file and store into an array?

View Replies !   View Related
Reading A .prn File
I have one prn file which contains chinese data that i want to read using php and then insert the values in database.

View Replies !   View Related
Reading File
I need to read a file that looks like this:

g1.jpg::Description #1
g2.jpg::Description #2

I need each side of that "::" to be a different variable and I need it in some kind of while loop till the end of the file. I've tried a coupld of split and explode versions and can't get it going, basically because of that end of the line when it starts a new one. This file displays descriptions for pictures in another script, and it splits it by of course as you can see the file name then the "::". But since I'm not reading the file list I can't get that other splitter.

I don't want to read the directory list because in case the file isn't there anymore I don't want that to conflict with reading the file out and displaying the contents. Basically what I want to do is have an input box for each one, and then at the end of the php file allow the user to click on save to save it back to the file if they edited anything.

View Replies !   View Related
Reading From A File
I know how to read form a file and get everything from inside the file, but now how would I use the variables from inside the file? PHP Code:

<?
$vf= "vars.php";
$gvf = fopen($vf, 'r') or die("Cant read from file");
$gv = fread($gvf, filesize($vf));
fclose($gvf);
?>

View Replies !   View Related
Reading From File
I have following code for putting contenst of a file into a web page:

<?php
$filename = "../msd/news.txt";
$handle = fopen ($filename, "r");
$content = fread ($handle, filesize($filename));
fclose($handle);
echo ($content);
?>
But in file news.txt I have formating that is not showing, but
interpreting.
For example, in that file there is:
<a href="link.php">link</a>
End result is hyperlink.

View Replies !   View Related
Reading And Writing From A File?
How would I go about reading and writing from a file? I would like to make a Web GUI for my sendamail virtualhosts.

View Replies !   View Related
Problem Reading From File
I have used this code in other projects, however, I'm geting an error that I don't understand.

Here is the error:

View Replies !   View Related
How To Open A File For Reading ?
i want to open a text file for reading. i tried this but nothing comes out ?

$fp = fopen("/u/htdocs/privat3/ttt/test.txt", "r");
fputs($fp, "GET ".$url." HTTP/1.0 r ");

View Replies !   View Related
Reading File Properties
I am trying to create a dynamic page that reads a user's browsing history and writes itself according to that. How can I use php to determine the properties of files?
Any ideas would be helpful.

View Replies !   View Related

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