I need to fetch content from a file that is located at a URL say "http://example.com/sample.html?user=."
This file will contain data in the following format:-
Item =Name|Unit=1 QTY|Market=INDORE|Price=5000|UpdatedDateTime=Jun 27 2012 8:149PM
After this line a <br> tag is used.
How do I store the content into database. What I actually wish to do is insert or update this content (such as Name, Indore, 5000, Jun 27 2012 8:14 PM) to their respective fields' name.
I am stuck up here. Any help would be appreciated.
I thought of using php's f-read mechanism but am not aware of how to pause after various symbols such as =, |, <br> .
Please help me !
techite
7
Newbie Poster
Recommended Answers
Jump to PostSomething basic I just wrote:
<?php $data = file_get_contents('url here'); $lines = explode( '<br />',$data ); foreach( $lines as $line ) { $line = explode( '|',$line ); $datum = array(); foreach( $line as $part ) { list( $key,$value ) = explode( '=',$part,2 ); $datum[$key] = $value; } …
All 3 Replies
Reply to this topic
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.