Hi all.
Is it possible to read the contents from website and insert the data to our DB.
I think it was possible to read data and insert to our DB.
If anybody did this, please instruct me to how to fix that.
Provide some solutions, logics or some code to fix this issue.
Is it possible to read data from other website
Moderator: General Moderators
Re: Is it possible to read data from other website
Try reading the following:
http://www.php.net/manual/en/function.fopen.php
You can read webpages just like you can read text files.
Or for more control, try:
http://www.php.net/manual/en/book.curl.php
http://www.php.net/manual/en/function.fopen.php
You can read webpages just like you can read text files.
Or for more control, try:
http://www.php.net/manual/en/book.curl.php
Re: Is it possible to read data from other website
Thanks mchaggis.
I am open the file using Fopen & read the contents Its working fine
By using strpos I will move to the particular position, Is it any way to get the character present on the previous 2 position.
I am open the file using Fopen & read the contents Its working fine
By using strpos I will move to the particular position, Is it any way to get the character present on the previous 2 position.
Re: Is it possible to read data from other website
Hi vinoth,
Without seeing you code I am not too sure what you are after doing. If you are searching for a string and then want the previous character 2characters before the found string, you probably just need to use substr:
Without seeing you code I am not too sure what you are after doing. If you are searching for a string and then want the previous character 2characters before the found string, you probably just need to use substr:
Code: Select all
<?php
if ( ($position = strpos( $data, 'string )) ) {
$char = substr($data, ($position-2),1);
}
Re: Is it possible to read data from other website
Hi mchaggis,
I am also used strpos() to find the particular text is present or not?
if(strpos() == false){
No action;
}else{
substr() function to cut the records from the string;
}
It was Working fine..
I am not sure, Is it sufficient or any or other better solutions ?
Please guide me, If any other possibilities available otherwise I kept the same as it was working currently.
I am also used strpos() to find the particular text is present or not?
if(strpos() == false){
No action;
}else{
substr() function to cut the records from the string;
}
It was Working fine..
I am not sure, Is it sufficient or any or other better solutions ?
Please guide me, If any other possibilities available otherwise I kept the same as it was working currently.
Re: Is it possible to read data from other website
I usually sty the function strstr to see if a string is within another string, however, for your code above, try the following:vinoth wrote:Hi mchaggis,
I am also used strpos() to find the particular text is present or not?
if(strpos() == false){
No action;
}else{
substr() function to cut the records from the string;
}
Code: Select all
<?php
if ( ($position = strpos( $data, 'string' )) ) {
$char = substr($data, ($position-2),1);
}
?>Re: Is it possible to read data from other website[RESOLVED]
Hi mchaggis,
Thanks for the suggestions & code you provided.
Its working Fine
Thanks for the suggestions & code you provided.
Its working Fine