Page 2 of 2

Posted: Tue Jul 25, 2006 7:43 pm
by feyd
If you can adjust the code in the file, just have it set a variable, otherwise, use ob_start().

Posted: Wed Jul 26, 2006 9:40 am
by tecktalkcm0391
OK well I am getting the contents of the page by using:

Code: Select all

// start CURL
$ch = curl_init(); 
// SET URL
curl_setopt($ch, CURLOPT_URL, 'http://site.com/'); 
// Username and password, separated by a colon. 
curl_setopt($ch, CURLOPT_USERPWD, 'username:password'); 
// Turns curl into a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// set to string
$str = curl_exec($ch); 
// close CURL
curl_close($ch);
But when I do

Code: Select all

$numbers = explode(' - ', $str, -1);
I only get 4 numbers instead of the 5 numbers I get on the page included. Is it because they are in the format of X - X - X - X - X... or what?

Posted: Wed Jul 26, 2006 9:44 am
by feyd
you've told explode to return all but the last 1.

Posted: Wed Jul 26, 2006 9:50 am
by tecktalkcm0391
well how could I do it so it does every number without setting it to 5 cause I wanting it to do it for what ever amount it sends so it would do X - X or X - X - X - X - X - X - X - X

Posted: Wed Jul 26, 2006 9:51 am
by tecktalkcm0391
Ah, I think I got something is it just you need to put a max number in so that say I won't have more than 100 X's just put in 100 in the spot?

Posted: Wed Jul 26, 2006 9:53 am
by feyd
don't send the last argument to it.

Posted: Wed Jul 26, 2006 9:56 am
by tecktalkcm0391
ok, thanks feyd. :)

Posted: Wed Jul 26, 2006 11:23 am
by tecktalkcm0391
Ok, Now I have another question. Sometime is there is a special something that goes with the numbers it prints out

Code: Select all

X - X - X - X  <br> Other: X 
How could I extract that from the variable $str and put it into $number[special] and remove the <br>

Posted: Wed Jul 26, 2006 4:10 pm
by tecktalkcm0391
I figured it out.. Thanks everyone :)