Member Avatar for ingeva

Searching for a solution to my problem I found this forum.
Hope someone here can help.

Instead of manually updating a table by using copy/paste from a web page, I would like to read the page directly from php. Pasing the contents would be a breeze, but I have no clue about how to read it.

Guess it could be done with sockets, but I know nothing about sockets, and from what I've read it requires an IP address, and what I have is a URL so it might need some DNS communication before I could set up the socket.

Or could I use wget to store the html in a file? Set up a pipe?

I'm fairly blank about this although I have been programming in php for some time.
If I just knew what to do ... :)

Thanks!

Member Avatar for ingeva

Actually I only thought about wget while writing the above post.

So I went ahead and tried it, and found that all I needed to do was

system ("wget --output-document=MYPAGE.txt ",$data);

Then I can read parse the MYPAGE.txt file.

I think it might be better to do this with cron so the script doesn't have to read the web page every time. After all, the page is not updated that frequently.

Thinking about it I could pipe the output to a php script that parses the output too, writing the parsed output to the file. Getting new ideas all the time! :)

Of course, if someone has an even better idea I'm all ears. And eyes. :)

Happy 4.th of July to all American friends!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.