Jump to content

Saving forms resulting html page


lokie538

Recommended Posts

Hi,

 

Ok what im trying to do is automatic enter a form and then save the resulting page. The thing is I need it to enter say "1" then save the html shown. Then enter "2" then save the resulting html page. So kinda a loop, im just unsure of what syntax to use.

 

I don'y have to use php so maybe a macro might help?

 

Any suggestions will be appreciated  :D

Link to comment
Share on other sites

Ok ill try and clear things up.

 

Im trying to save all the postcode information off this page: http://www.********.net.au/apply.cfm into a database. I know how to save the information into a database once it is stored on my computer in html files.

 

What im trying to do now is save the resulting page when say "4555" is entered.

 

Im not sure how to do it though, say making a loop with "4555" to be entered and when it is entered to save that page as "4555.html" and then it would enter "4556" in and then save it as "4556.html".

 

I know how to enter the postcode as "4555", but im not sure of how to loop it and save the file.

 

Hope that helps clear it up

Link to comment
Share on other sites

hmm im not sure what you mean?

 

Ive made this code to rip the info off each page

<?php
// Get file
$file = file_get_contents('file:///D:/apply.cfm.htm');

// Find main postcode
preg_match('~<tr><td width="90">Postcode:</td><td><span class="style1">(.*?[^<])</span></td></tr>~i', $file, $yourpost);
echo "Postcode: ";
print $yourpost[1];
echo "<br>";

// Find availability status (not needed)
preg_match('~<tr><td>Status:</td><td><font color="#009900"><b>(.*?[^<])</b></font></td></tr>~i', $file, $yourpost2);
echo "Available: ";
print $yourpost2[1];
echo "<br>";

// Find areas
preg_match('#<tr><td width="90">Suburb\(s\):</td><td>([^<]+)#s', $file, $match);

$arr = preg_split('#(?:\s{2,}|, )#', $match[1], -1, PREG_SPLIT_NO_EMPTY);

$n = 0;
$loc = "";

// String all suburbs together
while(isset($arr[$n])){
$temp = strtolower($arr[$n]);
$temp = ucfirst($temp);
$loc = $loc . ", " . $temp;
$n = $n + 1;
}
$loc = substr($loc, 2);
echo "Area's in postcode: " . $loc;

preg_match_all('~</td><td valign="top"><strong>(.*?[^<])</strong></td>~i', $file, $yourpost3);
echo '<pre>'.print_r($yourpost3, true);
?>

 

But im not sure how to bundle this into a loop, so it can record information on all the postcodes?

 

Say instead if it reading from this file ive got mentioned up there, it should read information from the html page with postcode

'4001" and then submit that form again to read from "4002".

 

Hope you understand

Link to comment
Share on other sites

Have a look at the javascript within the form page. Within that is an array containing the postcodes / towns.

 

By the way, there is a rather obvious notice on that page that you are not to rip content. I'm closing this topic for that reason.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.