|
-
Jun 2nd, 2007, 08:29 PM
#1
Thread Starter
Junior Member
Using Split?
Is it possible to use split in PHP? I want to know how to make it get some words from a website like in visual basic:-
Code:
mainstr = Inet1.OpenURL("http://www.google.co.uk/search?hl=en&q=vb6")
text1.text = "Results " & split(split(mainstr, "Results")(1), (0.05 seconds) ")(0)
I want to convert that into php, is it possible?
-
Jun 2nd, 2007, 08:39 PM
#2
-
Jun 2nd, 2007, 09:02 PM
#3
Thread Starter
Junior Member
Re: Using Split?
This is what I've done so far (trying to get my expire data on rapidshare)
Code:
<?php
function ExpireDate($username, $password) {
$page = @file_get_contents('https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi?login=' . $username . '&password=' . $password);
$splitx = split("valid until ", $page);
$splitx2 = split(" If " , $splitx[1]);
$result = $splitx2[0];
if ( $result == "" ) {
return "Unknown Error!";
}else{
return $result;
}
}
?>
But when I goto the page it asks me if I want to download the file (I do have a PHP enabled server)
Is there anything wrong in the code?
-
Jun 2nd, 2007, 09:14 PM
#4
Re: Using Split?
Yes the split function is explode().
-
Jun 3rd, 2007, 03:21 AM
#5
Thread Starter
Junior Member
Re: Using Split?
I've changed the words split to explode but it is still asking me if I want to download the file.
-
Jun 6th, 2007, 03:01 PM
#6
Hyperactive Member
Re: Using Split?
the explode function works like this:
$sentance = "This is a sentance with a lot of words";
$words = explode( " ", $sentance); // Splits it wherever there is a space
result:
$words[0] = This
$words[1] = is
$words[2] = a
$words[3] = sentance ... etc
-
Jun 11th, 2007, 03:38 PM
#7
Frenzied Member
Re: Using Split?
 Originally Posted by phpcoder
But when I goto the page it asks me if I want to download the file (I do have a PHP enabled server)
I would say there is something wrong with it. Unless you've tried another PHP file on the same server and had it work fine. Try setting the content type.
-
Jun 14th, 2007, 04:30 AM
#8
Lively Member
Re: Using Split?
just try to run a simple php file on the same server:
Code:
<?php
echo "It is running fine...";
?>
if it still ask you to download the file then something is wrong with the server... maybe apache is not running...
-
Jun 14th, 2007, 10:22 AM
#9
Thread Starter
Junior Member
Re: Using Split?
All other PHP files work, is it possible to use explode to find some text on a website, grab it and show it on the page?
-
Jun 14th, 2007, 10:26 AM
#10
Fanatic Member
Re: Using Split?
For finding something I would save the website to a string and then use strstr() or preg_match() to find it.
Never argue with fools, they will only drag you down to their level, and beat you with experience.
Q: How do you tell an experienced hacker from a novice?
A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|