473,396 Members | 1,894 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Search for string and then take string next to it.

Hi,

What I'm looking for is a way for php to retrieve a webpage, search for a
string in it, and next to that will be a date string in the format (e.g.)
03-Sep-04 22:37:40 BST, and then I'd like PHP to store that as a date/time
variable (preferably using unix timestamp)...

This possible?

Thanks,

Ben
--
BWGames
to email change de.news to de-news
Jul 17 '05 #1
5 1736
On Mon, 1 Nov 2004 08:14:58 +0000, BWGames wrote:
Hi,

What I'm looking for is a way for php to retrieve a webpage, search for a
string in it, and next to that will be a date string in the format (e.g.)
03-Sep-04 22:37:40 BST, and then I'd like PHP to store that as a date/time
variable (preferably using unix timestamp)...

This possible?

Thanks,

Ben


Also, the timezone is irrelevant, I just need a way of identifying dd-mm-yy
hh:mm:ss as a php date/time stamp to perform time calculations on it...
--
BWGames
to email change de.news to de-news
Jul 17 '05 #2
On Mon, 01 Nov 2004 08:14:58 +0000, BWGames wrote:
What I'm looking for is a way for php to retrieve a webpage, search for a
string in it, and next to that will be a date string in the format (e.g.)
03-Sep-04 22:37:40 BST, and then I'd like PHP to store that as a date/time
variable (preferably using unix timestamp)...

This possible?


http://www.php.net/strtotime

Adam

--
Adam Harvey
Optimiser Pty Ltd

To e-mail: don't make an example out of me!

Jul 17 '05 #3
On Mon, 01 Nov 2004 16:29:35 +0800, Adam Harvey wrote:
On Mon, 01 Nov 2004 08:14:58 +0000, BWGames wrote:
What I'm looking for is a way for php to retrieve a webpage, search for a
string in it, and next to that will be a date string in the format (e.g.)
03-Sep-04 22:37:40 BST, and then I'd like PHP to store that as a date/time
variable (preferably using unix timestamp)...

This possible?


http://www.php.net/strtotime

Adam


Thanks!

I now need to search for a string and return the next X characters to
it....

I'm guessing I'd use libcurl or similar to retrieve the webpage, and them
do strpos to find the string, but how to get the characters next to it?

I'm looking at
between... sometihng like between
between ('string1', 'string after what i want',$retrievedpage);

then strtotime...
That the best way?

Thanks,
ben
--
BWGames
to email change de.news to de-news
Jul 17 '05 #4
BWGames wrote:
I now need to search for a string and return the next X characters to
it.... [snip] I'm looking at
between... sometihng like between
between ('string1', 'string after what i want',$retrievedpage);

<?php
function text_after($haystack, $needle, $size) {
$pos = strpos($haystack, $needle);
if ($pos === false) return false;
return substr($haystack, $pos+strlen($needle), $size);
}

$text = 'one two three four five six seven';

$found = text_after('three', 5, $text);
if ($found === false) echo "Not found\n";
else echo 'Found: ', $found, "\n";
?>
--
USENET would be a better place if everybody read: | to mail me: simply |
http://www.catb.org/~esr/faqs/smart-questions.html | "reply" to this post, |
http://www.netmeister.org/news/learn2quote2.html | *NO* MIME, plain text |
http://www.expita.com/nomime.html | and *NO* attachments. |
Jul 17 '05 #5
Pedro Graca wrote:
<?php
function text_after($haystack, $needle, $size) {
$pos = strpos($haystack, $needle);
if ($pos === false) return false;
return substr($haystack, $pos+strlen($needle), $size);
}

$text = 'one two three four five six seven';

$found = text_after('three', 5, $text);
Oops, this last line should have been

$found = text_after($text, 'three', 5);
if ($found === false) echo "Not found\n";
else echo 'Found: ', $found, "\n";
?>

--
USENET would be a better place if everybody read: | to mail me: simply |
http://www.catb.org/~esr/faqs/smart-questions.html | "reply" to this post, |
http://www.netmeister.org/news/learn2quote2.html | *NO* MIME, plain text |
http://www.expita.com/nomime.html | and *NO* attachments. |
Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Ken Fine | last post by:
I'm looking to find or create an ASP script that will take a string, examine it for a search term, and if it finds the search term in the string, return the highlighted search term along with the...
2
by: CharitiesOnline | last post by:
Hello, I have set this script up to add paging to a search results page. Which on the first page works fine. I calculates how many pages there should be depending on the number of results returned...
14
by: Lee Mundie | last post by:
Hi, wonder if anyone can help me with this - This was originally a simple search routine returning results back to itself! Trying to be smart I tried to combine a no. items per page so I could...
0
by: todd | last post by:
here is a search tool SP I wrote. How many times have you wanted to search all your Stored procs or views (in a database) for a keyword but couldn't!? Well now you can! THis can makes life a...
32
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if...
3
by: Russell | last post by:
Hey, ok i have numerous tables to search through for a 'site search'. some of the searchble fields have html embeded within so after some quick referencing, saw I can use the regExp function...
1
by: Eric | last post by:
Hi: I have two files. I search pattern ":" from emails text file and save email contents into a database. Another search pattern " field is blank. Please try again.", vbExclamation + vbOKOnly...
1
by: lejason | last post by:
Hello, I am looking for a way to do a string search inside an xml. Basically, I work for a company that wants to export an XML file from and excel sheet and then have that data be presented on the...
4
by: ravindarjobs | last post by:
hi...... i am using ms access 2003,vb6 i have a form. in that i have 2 buttons 1. start search 2 stop search when i click the "start search" button the fucntion SearchSystem() is called,...
0
by: JamesOo | last post by:
I have the code below, but I need to make it searchable in query table, below code only allowed seach the table which in show mdb only. (i.e. have 3 table, but only can search either one only,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.