Dividing a String into parts [SOLVED]
Moderator: General Moderators
- tecktalkcm0391
- DevNet Resident
- Posts: 1030
- Joined: Fri May 26, 2006 9:25 am
- Location: Florida
OK well I am getting the contents of the page by using:
But when I do
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?
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);Code: Select all
$numbers = explode(' - ', $str, -1);- tecktalkcm0391
- DevNet Resident
- Posts: 1030
- Joined: Fri May 26, 2006 9:25 am
- Location: Florida
- tecktalkcm0391
- DevNet Resident
- Posts: 1030
- Joined: Fri May 26, 2006 9:25 am
- Location: Florida
- tecktalkcm0391
- DevNet Resident
- Posts: 1030
- Joined: Fri May 26, 2006 9:25 am
- Location: Florida
- tecktalkcm0391
- DevNet Resident
- Posts: 1030
- Joined: Fri May 26, 2006 9:25 am
- Location: Florida
Ok, Now I have another question. Sometime is there is a special something that goes with the numbers it prints out
How could I extract that from the variable $str and put it into $number[special] and remove the <br>
Code: Select all
X - X - X - X <br> Other: X - tecktalkcm0391
- DevNet Resident
- Posts: 1030
- Joined: Fri May 26, 2006 9:25 am
- Location: Florida