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.





Q: Read Text With VBA From A PHP Web-page


I created a page on our intranet that shows a number and that
increases for every time the page is opened. It is similar to a
visitors-counter.
When I look at the page with Internet Explorer it works just fine.

Now I want to read this web-page from a MS-Word macro and include the
number as a company wide unique id in my MS-Word document.
Unfortunately, the PHP script doesn't update the counter when I call
it from my MS-Word macro.

How can I force PHP to update my counter when I call it from a VBA
macro?

I am using the following code:




View Complete Forum Thread with Replies

Related Forum Messages:
Read And Display Japanese Text From Text File
I posted a question regarding reading japanese
text from a text file.

Well, since I solved the problem, I thought I'd post my solution for
the benefit of other people with the same problem.

The plan was to make a script to read and display japanese text. I
will use it for making a japanese proverb script and for a japanese
language study script.

Method :

I wrote a simple kanji text file (saved with UTF-8 encoding)
I wrote a simple PHP script to display the file contents (saved with
UTF-8
encoding)
I specified the content-type header for the HTML page :
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

*** All files have the same encoding. ***

UTF-8 supports japanese characters.

and it works!

this is my PHP (and HTML) script :

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>PHP : Japanese Text File Read : Exercise 1</title>
</head>
<body>

<?php

$filename="japanese.txt";
//open file
$fp = fopen($filename,'r');

//loop through each line in the file
while($line=fgets($fp))
{
//output current text file line
print $line."<br>";
}
//close file handle
fclose($fp);

?>

</body>
</html>

I know it's a very simple script, for testing purposes only. It
displays the contents of the japanese text file line by line.

The key was to save all files in the same encoding (I used UTF-8) and
to specify the encoding / charset in the HTML header (<meta
http-equiv="Content-Type" content="text/html; charset=utf-8">)

View Replies !
Pass The Variable From 1st Page And Read It With Other Name On 2nd Page
I am new to this and learning slowly, but I was hoping someone could give me some quick advice on how to create a variable on one page and have it passed to another to be read as an ID for a mySQL database.

I want to pass the variable "varRevID" from one page and have it read as "reviews_id" on the other.

My database is pulling from just the first record and I would liek to designate from the pointing page which record to pull from.

View Replies !
How Can I Read Text From PDF Files?
Can you someone tell me how can I read text from PDF files?

View Replies !
Read Text File
i need to read a text file n extract the text into a variable for later use for each row of text. i know this sounds like an easy tasks but i have been having trouble over it. i keep receiving 'array' instead of the actual text in my text file. example of wat my text file looks like :

hello world1
hello world2
hello world3
hello world4
hello world5
hello world6
hello world7
hello world8
hello world9
hello world10

View Replies !
Read In A Text File
I'm looking at reading a text file into a webpage using the INCLUDE command, however this text file will have no html formatting at all, just a couple of paragraphs. The problem is HTML will see this as one long line of text and not see the start of a new line and paragraph unless you put in the html code needed. Hence my problem. I remember a command which would output this differently and solve this problem but it was a long time ago.

View Replies !
Read In Text File
I've got a web page where I'd like someone other than me to be able to upload a .txt file (with that week's headlines, etc) and display it on the web page. That part works - easy - but how can I format it a little better? Or is there a better way to execute what i want to do? Below is code I'm using to read file in -

<?php $file="varsity.txt";
$fp=fopen($file,'r');
$content=fread($fp,filesize($file));
fclose($fp);

//Then, add a <p> to the beginning, and a </p> to the end, and use
//str_replace to replace all char(10) (new lines) with </p><p>

$content = "<p>".$content."</p>";
$content = str_replace(chr(10),"</p><p>",$content);

//Then output the variable:

echo $content ;?></div>

View Replies !
Read Text Dile
i want to tak a text file which is a table and take the contents of each sell and add to a database here is what i have:

// open the text file and read the entire file into $filegets.
$handle = @fopen('mytextfile.txt', "r");
if ($handle) {
while (!feof($handle)) {
$buffer = fgets($handle, 4096);
$filegets = $filegets . $buffer;
}
fclose($handle);
}
// extract from start of table to close of table
$start = "<table border=0>";
$end = "</table>";
$tmpget = explode($start,$filegets);
$result = explode($end,$tmpget[1]);...

View Replies !
How To Read HTML Email Text?
I've done a couple of hours web-searching without turning up many
answers so far, and I guess I could figure it out (eventually) from
the MIME format, but here goes with my question...

I don't have any problems reading text emails, but can anybody direct
me to some PHP source code that will read (the text inside) an HTML
email, specifically the "From", "Subject" and especially the message
body?

I would like the code to be able to differentiate between (i.e. know
that it is) a text or an HTML email, and I would like the code to
ignore any attachments.

I don't expect the incoming email to have any (or large) attachments,
but I hope that any code samples can handle the possible case of big
attachments coming along for the ride.

Incidentally, if I did (not this time) want to handle large
attachments, can PHP and/or servers handle megabytes of data being
read into a string variable through fread()? I'm just getting into
this stuff, and not sure of what areas would be a resource and/or
performance hog.

View Replies !
Formatting Text - Read More .. Link
I am currently looking for a way to have text that is entered in my news service (it is added to a databse, then displayed) to be cut off after a certain length on some pages (mainly the front page)...kind of like what you see on some sites with the "read more" at the end. I want it so i could enter a long news/article update, then on the home page it would be shortened, and when the user clicks on the title, it takes them to the detail page with the full length article. I am using dreamweaver, if that makes any difference.

View Replies !
Text File Read / Write
im trying to make a poll that uses a text file for storing totals, and...well its not working. I have a text file with 5 values seperated by semicolons, like 1;2;3;4;5, and that file is poll1.txt. If I supply the script with an option, it will succesfuly read and show the contents of the file, but when I try to change one of the values and put it back, it fails. It writes to the file with loads of black squares and more semicolons than are in the $newresults variable. Follows is the incorrect code:

View Replies !
Read Text File And Store In DB
Is it possible to upload a text file, read the contents and extract certain strings, words, phrases, etc. from it and store it in a mySQL database for later searching via the web? If so, are there any scripts/modules out there that accomplishes this?

View Replies !
Read And Write To A Text File
San someone supply me with a PHP script to read and write to a text
file on the server

View Replies !
Read Line From Text File
I have a text file that i would like to use PHP to read from. each line
ends with a. I need to read from the beginning of the line, only upto that:

right now i'm using this, which is sloppy and slow:

if ($chr = fgetc($file)) != "") { }

which of course reads in one byte at a time till the end of line. is there
a better way?

View Replies !
Read And Write To Text File
I am trying to do a simple thing: read a line from a text file and write this line to another text file. The problem is: when I write the text into the new file there is an empty space between each characters. EG my original line is abcdef and the result is: a b c d e f  &#8299;. I tried and tried, searched google, but I am stuck... How can I read line n from one file and write it to another file exactly the same?

View Replies !
Read Variables From A Text File.
this is a simple question, but it has such a major importance on how my script will turn out. I am trying to make a hub, in which website names are stored in text files (1 - unlimited numbers).

I am trying to see if there is a way that PHP can read the variables stored in a text file. For example. in a text file I have the varable

$site = "http://google.com";

and in my php script it would open up the text file and then read the variable $x from there it would echo

Site is http://google.com

is all of this just wishful thinking, or is there such a way to make this really exist.

View Replies !
Read Text From Jpeg/jpg Image
Is there any image recognition script out there that can help me read text from a jpg image.

View Replies !
Read And Display Text File
I have a web site that has a text file indicating the results of golf, tennis, and swimming events. I would like to scroll those results on the web page by reading the text file and simply scrolling it to an area on the web page.

View Replies !
Setting Text Field To Read Only
I have a form which, based on some DB lookup factors, sets a series of text fields to disabled or enabled. Code:

View Replies !
Read Text File, Problem
i'm reading in a text file and found a major problem, it seems that the txt file is saved as unicode, its a chat log which i want to read in and display.

However because its saved as this format, there is a space after every character, you only see this though when doing source code view.. but appears normal on the webpage..

Is there a way to read the file in another format.. etc..

View Replies !
PHP Will Not Read More Than 4096 From My Microsoft Sql Text Field.
I have a textarea that is saving to a mssql text (very large) field. The insert, update is working fine. However, when php reads the data using mssql_result function, I'm getting limited to 4096 characters read by php. I know that there are at least 6000 characters and I can see them using microsoft's query analyzer. This is not a magic quotes, single quote, quote, html entity or anthing like that. PHP will not read more than 4096 from my microsoft sql text field. Any ideas how I can get php to read more?

View Replies !
Read A Text File Where Contents Are Going Over 2 Lines
I have this code to read the contents of a text file: PHP Code:

View Replies !
Read The Contents Of A Text File Into MySql Using PHP
New to this, have the basics, can build a form and such. My problem is I
need to be able to open a file on a pc/s on the network, read the data
character by character, check to see if a certain character is present, if
it is, update the database and continue reading the file until it comes
across the character again, updates the database and so on . . . .

View Replies !
Write A Function That Will Read In A Text Document
I'm trying to write a function that will read in a text document containing various bespoke tags which I then expand into the appropriate HTML. I've done most of them but was wondering if someone could help me with this particular one .. I'm guessing I should be using preg_replace but can't seem to get it to work.

I have a variable called $rec_id which is an integer. The following is the conversion I want to perform: Code:

View Replies !
Best Way To Read A Text File And Extract Information
i have a log file of which i need to extract certain bits of information the problem is the file never stays the same a sin line numbers and is always updated every 1 minute with new data depensing on connections on the VPN system... Code:

View Replies !
Read/Write Text File Manipulation
I have a script that writes a hit to a text file, but lately I have been noticing that the text file number is decreasing, instead of increasing or stay the same. Could some one be doing this and if so what is a good security measure to put into place to prevent this from occuring? I would prefer not to register the hits in a database; I would rather stick to a text file storage medium for this case.

View Replies !
Read A Text From Any Image Then Display It To The User.
Is it possible to read a text from any image then display it to the user.
if yes how ???

View Replies !
Read From A Text File, Output To Browser In Japanese
I am trying to store data in a text file and output it to the browser
using PHP. All very easy - if I was using English! the problem is, I
want to use Japanese and I'm finding it a tad difficult to get PHP to
understand. I have two files, a text file containing data to display
and a php file with a script to display the data. I can get the
contents of a text file displayed in English, no problemo, but in
Japanese, it's another story...

All the correct settings are enabled in the php.ini file for Japanese
language support (mb_string, input_encoding, output_encoding settings
etc..etc..) even if I save the text file, to be read from, in
Shift_JIS encoding - I still can't get it to display normally!

here's the script I'm using to read the text file :

<?
$filename="test.txt";
$fp = fopen($filename,'r');
while($line=fgets($fp))
{

//output text file line
print $line."<br>";

}
fclose($fp);
?>

View Replies !
How To Read A Text File Into An Array And Echo The Each Line?
how to read a text file into an array and echo the each line(each array element) by using file().

View Replies !
I Need Multiple Scripts To Read Different Parts Of The Same Text File.
Basically, I need some dynamic pages that can read a text file, and base the content of the (viewable) html around some of the text contents. Code:

View Replies !
Read Contents Of Directory - If Not Text Files Exit
I have to make a page that shows the contents of a directory BUT if there are no text files in the folder I am supposed to kill the script. Code I tried (for that specific part of the script) was: Code:

$directory = dir("./courses/");
if(!(isset($directory[2]))){
die("No files in directory");
}

To my knowledge $directory[0] would be taken up by "." and [1] would have ".." so I thought if [2] isn't set then there isnt an actual file in the directory. I am sure there must be a better way of doing this however as [2] could easily be taken up by a folder or image and still come out true that there is a txt file.

View Replies !
Is It Possible To Read ASP.NET Web Page In PHP?
Is it possible to read another web page in PHP?
If is ASP.NET, the code would be
------------
WebRequest req=WebRequest.Create("http://www.microsoft.com");
WebResponse res=req.GetResponse();
StreamReader sr = new StreamReader(res.GetResponseStream());
String Output=sr.ReadToEnd();
Response.Write("The content is : " + Output);
--------

View Replies !
Read A Web Page
i want to store(read) the contents of a "web page" into a file. how can i do it in PHP. Please help me. The web page contains a table. i want to fetch & store the contents of that table into a file.

View Replies !
Make Text String Read From Right To Left In Imagettftext() Function
I want to write a text string from right to left instead of from left to right with the imagettftext (); function

I read in teh manual that the angle variable controls this, it says that 0 angle means left to right, so I tried 180, 360 but nothing happens What angle do I need to put it to get it to write it right to left. Code:

View Replies !
Read A Web Page And Then Display
I'd like to read a webpage, the parse it and display a small part of
it. Here is what I've tired. It isn't working.

<?php
$handle = fopen("http://www.yahoo.com/", "r");
$contents = fread($handle, filesize($filename));
echo $contents;
?>

View Replies !
Read An HTML Page
It may sound kind of crazy, but I'm trying to see if there's a way php code can 'read' contents of a static HTML page and store the contents into a variable. Is it possible? If so, how?

View Replies !
Load Page Then Read
Is there a way to completely load the page of its HTML elements then read all those elements into a string? For example, I have a PHP page that get its HTML content from the database. I want that page to completely loads, ie., get the content from the database, then write all of that page's text and html elements into a string so I can modify it (ie. remove all the links) to display it in another page.

View Replies !
Read Previous Page Url
I have a query regarding browser url.Let me narrate the exact scenario which i need. I would like to expire my session when a person enters different url in the navigator bar other than my url and comes back to my url. For example if i visit example.com and then i type gmail in the same navigator bar and then move back to my url example.com through browserback button then i have to end the session of my client i mean he has no more access to my site. The same scenario is there for icicibank.com. I wanna the code using php and javascript.

View Replies !
Read Page To Variable
I have tried tons of functions but none works the way I want. I have a page foo.php. Then in that I set a couple of variables. Now, if I include foo.inc.php that file can use all of these variables. Code:

View Replies !
Code To Read A Web Page
How can I read another web page in php. I tried:

$url = 'http://www.yahoo.com'
$contents = file_get_contents($url);
echo $contents;

but I get an error: The specified CGI application misbehaved by not returning a complete set of HTTP headers.

View Replies !
Read And Print The Contents A Text File Which Resides In A Remote Location Via PHP?
Is it possible to read and print the contents a text file which resides in a remote location via PHP? For instance, this is how I am currently reading a text file that is my local server (and it works great, but unfortunately the text file my client will need to have read is outputted to a remote location):

<?php
$currentSong = "/home/medusa/sun/accounts/username/public_html/ticker/current-song.txt";
$fh = fopen($currentSong, 'r');
$theData = fread($fh, filesize($currentSong));
fclose($fh);
echo "<p>".$theData."</p>";
?>

View Replies !
Which Function Do I Need To Read The Page Through Http?
I need read the html page through http and extract the links from it. Which function is better to use for this purpose: fopen() + fread(), file_get_contents(), or fsockopen()?

View Replies !
Read Data From External Page?
I have tried to think of a solution to this problem, but i can't find it. My question is: If possible, how do you from your own page confirm that a form has been send from an external page?

View Replies !
Page Not Read By Conditional When In Sub Folder
I'm using some php conditionals in included footer.

I identify some pages at the top with -

$page='alt_footer'

then have a conditional in the footer.php, like -

if ($page!='alt_footer') {

All works great, but if I put the page in a sub directory (making path adjustments for the includes), it is not recognized as having $page='alt_footer'

All path relationships between the page (in sub folder) and the includes (in folder at same level as sub folder) work fine, just the conditional (from the include to the page) is not recognized.

View Replies !
Can't Read Remote Web Page From Local Apache/PHP
I'm trying to read the contents of any Web page on another
host. I'm finding that...

echo file_get_contents( 'http://www.php.net' );

.... works fine if I upload the PHP script to my Web host, and run it
there. But if I run it on my PC, which is running Apache 1.3.33
(Win32) and PHP 5.0.5, then it always times out, and gives me the error
message...

[error] PHP Warning: file_get_contents(http://www.php.net) [<a
href='function.file-get-contents'>function.file-get-contents</a>]:
failed to open stream: A connection attempt failed because the
connected party did not properly respond after a period of time, or
established connection failed because connected host has failed to
respond.

I get the exact same results using...

$fh = fopen( 'http://www.php.net', 'r' ) or die( $php_errormsg );
while (! feof($fh)) {
$page .= fread($fh,1048576);
}
fclose($fh);
echo $page;

Anyone know what could cause this to happen?

View Replies !
Transfer Certain Portions Of Text From The Right Page To The Left Page.
I have a page split in two and I want to be able to transfer certain portions of text from the right page to the left page.

View Replies !
Read The Page Of The Site & Rerturn The Contents Of MEMBERS_URL & MEMBERS_NUMBER
a line on my site reads MEMBERS_URL="my2ndsite.com" MEMBER_NUMBER="12345" . Im Trying to read the page of the site & rerturn the contents of MEMBERS_URL & MEMBERS_NUMBER, but i cant get it to work can anyone suggest where ive gone wrong please PHP Code:

$myfile = file("http://www.mysite.com");
foreach ($myfile as $row=>$data) {
if (preg_match('/MEMBERS_URL="(.*?)" MEMBERS_NUMBER="(.*?)"/',$data)) {
echo $data[1];
echo $data[2];
}
}

View Replies !
Get The Text Within The Text Box To Transfer To Another Page.
I have found a free rich text editor for my website. I have played around with the code to get the text within the text box to transfer to another php page. My problem is that the varible is passed with. I have set up a page to remove them but nothing happens. The code:

View Replies !
When A Search Engine Spiders A Page Does It Read The Raw Code Or The Parsed Html?
When a search engine spiders a page does it read the raw code or the parsed html? I ask as I want to confirm if any text retrieved from a database is 'read' not the php code that gets the data.

View Replies !
Read A Text File Then Find Keywords In That File
how do i make php read a text file then find keywords in that file and only display the results of what it found (i'm going to use wildcards with the keywords so i can sort data to different text files)that way it can only display the part of the text it found and write it to a new text file. i was wondering if anybody could give me an example of that or tell me what commands?

View Replies !
Read Text File Line By Line
I have been given a textfile which contains data on 1000 businesses.  Each line contains a name and a code which are seperated by a comma.  The code below allows me to display the entire textfile but I want to read in the values from each line and store these in a database.

$filename = "businesses.txt";
$fileToOpen = fopen($filename,"r");
$content = fread($fileToOpen, filesize($filename));
$content = nl2br($content);
fclose($fileToOpen);
echo($content);

Does anyone know how I can read the data in line by line so that I can store it in a database.

View Replies !
Email With Attachment - Annot Be Accessed. The File May Be Read-only, Or You May Be Trying To Access A Read-only Location.
It is a basic email with an attachment. The email and attachment are getting sent and received ok. When the recipient tries to open the attachment, the right application opens (eg. Excel) but then throws up an error. I am using base64 encoding. For example:

.xls file with base64 encoding:
'testing.xls' cannot be accessed. The file may be read-only, or you may be trying to access a read-only location. Or, the server the document is stored on may not be responding.

.pdf file with base64 encoding:
There was an error opening this document. The file is damaged and could not be repaired.
so the file isn't being decoded right. I have tested on Yahoo and Outlook. PHP Code:

View Replies !
Fgetcsv Returns False In Dynamic Read Vs. Hard-coded Read ??
I am working with directories in PHP for the first time. I have code
that I've changed multiple times to try different things. I would think
this is pretty standard fare so I'm not sure why I can't seem to get it
right.

What I would like to see happen:

The code opens the directory and loops through the files, opening them
and processing them.

What is happening:

If I hard code the name of one particular file (it is always the same
file) in my test setting, fgetcsv does not return false and the code
runs fine. The file is parsed and all is well. However, if I let the
code open a directory and then loop through the files, this one
particular txt file does not work. For debug purposes, I have it
displaying each file name and it can display the name, it just won't
process it.

I've even tried setting a for loop and hard coding each file name
(since right now I know the names - I won't in the future) and the file
is processed. It is only when it is set to my $file var dynamically
rather than being hard coded.

Here is the code:
$handle_dir = opendir('../directory_name');
/* loop over the directory. */
$countfile=0;
while (false !== ($file = readdir($handle_dir))) {
$countfile++;
$filevalues = "";
//Skip the first two files that where found because they are
"." and ".."
if ($countfile 2) {
//echo $file;
//begin loop through each file name
$handle = fopen($file, "r");
echo "Filename is: $file<BR>";//at this point the
code can print the file name
if (false == ($filevalues =
fgetcsv($handle,6021,','))){
echo 'problems<br>'//for one particular file,
this always displays
}

View Replies !

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