|
|
In any language that has a library permitting TCP/IP requests.
Okay, so you know how you have getElementById and getElementByName available in javascript? Well, it seems there's no such luxury available in php. The task is a little more onerous, though not much.
First, you read the remote web-page as a file, using fopen.
Next you use regular expressions to extract the parts of the file that you want. After you've extracted the data you require, it's up to you to open your results.txt and append the data extracted from the web-page.
Here's a couple of links that should have enough to get you started.
http://www.drquincy.com/blog/get-remote-web-page-info-with-php/[^]
http://www.hiteshagrawal.com/php/html-scrapper-in-php[^]
|
|
|
|
|
$s=file('http://www.abc.com/d.txt');
$size=count($s);
$ud = fopen("yaka.txt","w");
for($x=0;$x<$size;$x++)
{
$line =trim($s[$x]);
fwrite($ud, $line);
}
I want to write in next line.how to do this.
Example :- data is in .txt file
12,54,45
78,87,96
23,54,64
and i also want in same format but i am getting like this....
12,54,4578,87,9623,54,64
What to do ? help me
|
|
|
|
|
udch wrote:
fwrite($ud, $line);
I may be rusty on my PHP, but I believe what you need to do is add a newline character to each line after you fwrite it. Perhaps something like this?
fwrite($ud, $line . "\n");
Adam Maras | Software Developer
Microsoft Certified Professional Developer
|
|
|
|
|
Thanks for your help brother but it is not working it is only adding
[] something like this may be space because it is not visible here.Thanks again for you help bro.
|
|
|
|
|
Which file viewer are you using ?
|
|
|
|
|
fwrite($ud, $line . "\r\n");
If at first you don't succeed, you're not Chuck Norris.
|
|
|
|
|
Thanks again For you help brother your code is working.
|
|
|
|
|
I have downloaded the cck module,and it has been copied to modules of my drupal site.Now how to include a text box inside my page?
|
|
|
|
|
I have downloaded the cck module,and it has been copied to modules of my drupal site.Now how to include a text box inside my page?
|
|
|
|
|
How to round this 106.19999999999999 number like 106.20 by using java script or php?
|
|
|
|
|
What would be an appropriate Google search for your question? How about 'round number javascript'[^] or 'round number php'[^].
Please try and answer your question yourself by doing some research ie. using Google or reading a book, as you learn more that way, rather than getting spoon fed with very simple questions where the first link on Google reveils the answer.
If at first you don't succeed, you're not Chuck Norris.
|
|
|
|
|
He posted this in Java as well.
If he doesn't get java != javascript, then don't count on his google talent to save the php board as well.
|
|
|
|
|
Thank you very much for your help brother. You are such a nice person.Thanks again.
|
|
|
|
|
I am searching for a user defined function which take the input and display the form by itself. what all we need to do is just supply it variables required. Can anyone help me?
|
|
|
|
|
you'll have to create it yourself as you'll probably need to say wether inputs are text/file, include css classes etc
What you can do though is put it in a function:
If you want to cut some corners you can try using jquerys form submission and php has a function to split up a query string (GET only I think).
|
|
|
|
|
http://ck.com/me.php?scrip=500490
$us="";
if($us=='507878')
{
$us='rock';
echo $us;
}
??
<title><? echo $_GET['us'] ?>
how to make this code working ?
modified on Sunday, July 26, 2009 5:04 AM
|
|
|
|
|
<html>
<head>
<title>
</title>
</head>
<body>
<?php
$us=507878;
if($us=='507878'){
$us='rock';
echo $us;
}
?>
</body>
</html>
|
|
|
|
|
How to use wild card in php ? like dos.Example :- c:/copy *.* c:/yoyo/*.* can php do this job?
|
|
|
|
|
Is this a result of using the previous code given to you? In which case you do know that you can specify the location that you are saving the new file eg. 'yodo/newFile.txt'
Also you can skip the copying of the file from one site to yours, which I suggested earlier, by simply reading the file straight from the other site.
function copyOldFileToNewFile($oldLocation, $destinationFolder)
{
$splitted = explode('/', $oldLocation);
$newLocation = $destinationFolder.$splitted[count($splitted) - 1];
$fh = fopen($newLocation, 'x')
or die("unable to open file");
foreach (file($oldLocation) as $oldLine)
fwrite($fh, str_replace('" "', '', $oldLine));
fclose($fh);
}
copyOldFileToNewFile('http://www.ab.com/ab.txt', 'yodo/');
If at first you don't succeed, you're not Chuck Norris.
|
|
|
|
|
I have opened the SQL premier database file(mdf file) in Microsoft Visual Studio Version selector by mistake.Is it possible for me to restore the previous format.
I am using Microsoft SQl server with .net dataprovider.
I am using Vista.
Thanks.
|
|
|
|
|
Can I execute DOS command in client mashines with PHP
|
|
|
|
|
Client machines? Certainly not.
Adam Maras | Software Developer
Microsoft Certified Professional Developer
|
|
|
|
|
I think with you. I want to get client MAC address using PHP
|
|
|
|
|
How to write .txt file in php ? suppose i am reading ab.txt file form ab.com and want to write this file for my own website in my web server so how to do this job ?
|
|
|
|