troubleshooting Question

PHP Write to file with variable in that file as the resulting NEW file name.

Avatar of selvol
selvolFlag for United States of America asked on
PHP
4 Comments1 Solution230 ViewsLast Modified:

I have a complete coded php page with. This also on it.

Except the metadata formatting The keyword are not the same on any pages.

Page 1 example

<meta name="keyword" content=SMITH, JOHN, DOE, PLAIN, JAIN, MAIN, JOE, SOMEONE, WILLIAMS">

Page 2 example

<meta name="keyword" content=Mike Bill, Paul, Jenn, Ted">


What  I am attempting to do is  have PHP process the page and write it to a NEW TEXT file.
NAMING THE NEW FILE using the First 3 Meta Keywords in that file..

Basically Run a page thru PHP and having the result be a txt file  created and named using that files meta KEywords.
The two examples above would include the ordinal page code and be names as so.
smith-john-doe.txt  
mike-bill-paul.txt

The commas and space parsed into hyphens and no space.

I have attempted to solve this myself with some good results.
But not what I needed.


$myFile = "KEYWORDS.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "HELP";
fwrite($fh, $stringData);
fclose($fh);





The pages if needed can have the new code I anticipate as the ONLY PHP script on that page.




The page is processed via PHP using this code.

Thank you agian Ray_Paseur

https://www.experts-exchange.com/codeSnippetPopup.jsp?csid=348721

REGARDS AND thank you.

Selvol
ASKER CERTIFIED SOLUTION
DerkArts

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros