PHP hulp nodig :)

Gestart doorMarvinn11 reacties57 weergaven

12 berichten · pagina 1 van 1

Marvinn

Lid · Topicstarter

Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik zit even met een moeilijke script.

Ik heb dit:
Spoiler tonen
// ## Habbo missie ## 
function getHabboMotto( $Home ) //Grab the Habbos motto 
{ 
    if ( !$Home ) 
    { 
        return false; 
    } 
    else 
    { 
        $mottoStart = explode(<div class="profile-motto">, $Home);
        $mottoEnd = explode(</div>, $mottoStart[1]); 
        $mottoTrim = trim($mottoEnd[0]); 
        $motto = str_replace(        <div class="clear">, , $mottoTrim);
        return $motto; 
    } 
}
En ik heb ook:
Spoiler tonen
[COLOR= #0000BB]<?php
    $hotel[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR] [COLOR= #DD0000]hotel[/COLOR] [COLOR= #007700]];[/COLOR]
    [COLOR= #0000BB]$naam[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR] [COLOR= #DD0000]habbo[/COLOR] [COLOR= #007700]];[/COLOR]
    [COLOR= #0000BB]$url[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"http://habbo."[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$hotel[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]"/home/"[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$naam[/COLOR][COLOR= #007700];[/COLOR]

    [COLOR= #0000BB]$data[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/file_get_contents"]file_get_contents[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$url[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$explode[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/explode"]explode[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]<span id="guestbook-size">[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$data[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$readend[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/explode"]explode[/URL][COLOR= #007700]([/COLOR][COLOR= #007700]<[/COLOR]/span[COLOR= #007700]>),[/COLOR] [COLOR= #0000BB]$explode[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]]);[/COLOR]
    
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$naam[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]" heeft "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$readend[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]" berichten"[/COLOR][COLOR= #007700];[/COLOR]
?>
En hij moet het zelfde worden als de eerste code.

Weet iemand hoe?
0
Berichten
16
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik weet niet.
0
Tom

Lid

Berichten
3.868
Reputatie
0
Punten
0,02
Lid sinds
Laatst gezien
Ik snap je niet, als je ze hetzelfde wilt dan kopieer en plak je gewoon?
0
Marvinn

Lid · Topicstarter

Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
// ## Habbo missie ## 
function getHabboMotto( $Home ) //Grab the Habbos motto 
{ 
    if ( !$Home ) 
    { 
        return false; 
    } 
    else 
    { 
        $mottoStart = explode(<div class="profile-motto">, $Home);
        $mottoEnd = explode(</div>, $mottoStart[1]); 
        $mottoTrim = trim($mottoEnd[0]); 
        $motto = str_replace(        <div class="clear">, , $mottoTrim);
        return $motto; 
    } 
}


[COLOR= #0000BB]<?php
    $hotel[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR] [COLOR= #DD0000]hotel[/COLOR] [COLOR= #007700]];[/COLOR]
    [COLOR= #0000BB]$naam[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR] [COLOR= #DD0000]habbo[/COLOR] [COLOR= #007700]];[/COLOR]
    [COLOR= #0000BB]$url[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"http://habbo."[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$hotel[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]"/home/"[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$naam[/COLOR][COLOR= #007700];[/COLOR]

    [COLOR= #0000BB]$data[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/file_get_contents"]file_get_contents[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$url[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$explode[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/explode"]explode[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]<span id="guestbook-size">[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$data[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$readend[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/explode"]explode[/URL][COLOR= #007700]([/COLOR][COLOR= #007700]<[/COLOR]/span[COLOR= #007700]>),[/COLOR] [COLOR= #0000BB]$explode[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]]);[/COLOR]
    
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$naam[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]" heeft "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$readend[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]" berichten"[/COLOR][COLOR= #007700];[/COLOR]
?>


Het is een hele andere code maar ik wil de onderste code in de bovenste hebben maar ik snap niet hoe?
0
Berichten
5.274
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien

Eindhoven, Nederland

function getHabboMotto( $naam )  
{ 
$url = "http://habbo.nl/home/" . $naam;
$home = file_get_contents($url);
    if ( !$Home ) 
    { 
        return false; 
    } 
    else 
    { 
        $mottoStart = explode(<div class="profile-motto">, $Home);
        $mottoEnd = explode(</div>, $mottoStart[1]); 
        $mottoTrim = trim($mottoEnd[0]); 
        $motto = str_replace(        <div class="clear">, , $mottoTrim);
        return $motto; 
    } 
}


Zoiets? confused
0
Marvinn

Lid · Topicstarter

Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nee ik bedoel:

[COLOR= #0000BB]<?php
    $hotel[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR] [COLOR= #DD0000]hotel[/COLOR] [COLOR= #007700]];[/COLOR]
    [COLOR= #0000BB]$naam[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR] [COLOR= #DD0000]habbo[/COLOR] [COLOR= #007700]];[/COLOR]
    [COLOR= #0000BB]$url[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"http://habbo."[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$hotel[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]"/home/"[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$naam[/COLOR][COLOR= #007700];[/COLOR]

    [COLOR= #0000BB]$data[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/file_get_contents"]file_get_contents[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$url[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$explode[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/explode"]explode[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]<span id="guestbook-size">[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$data[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$readend[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/explode"]explode[/URL][COLOR= #007700]([/COLOR][COLOR= #007700]<[/COLOR]/span[COLOR= #007700]>),[/COLOR] [COLOR= #0000BB]$explode[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]]);[/COLOR]
    
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$naam[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]" heeft "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$readend[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]" berichten"[/COLOR][COLOR= #007700];[/COLOR]
?>


Moet zo worden:

// ## Habbo missie ## 
function getHabboMotto( $Home ) //Grab the Habbos motto 
{ 
    if ( !$Home ) 
    { 
        return false; 
    } 
    else 
    { 
        $mottoStart = explode(<div class="profile-motto">, $Home);
        $mottoEnd = explode(</div>, $mottoStart[1]); 
        $mottoTrim = trim($mottoEnd[0]); 
        $motto = str_replace(        <div class="clear">, , $mottoTrim);
        return $motto; 
    } 
}


In de zelfde soort stijl.

De bovenste is heel anders dan de onderste. En dat wil ik juist niet yummie------------------------
Want als ik dit doe:

// ## Gastenboek ## 
function getGast( $Home ) //Grab the Habbos motto 
{ 
    if ( !$Home ) 
    { 
        return false; 
    } 
    else 
    { 
        $explode = explode(<span id="guestbook-size">, $Home);
        $readend = explode(</span>, $explode[1]); 
        return $readend; 
    } 
}


Krijg ik Array
0
Fass

Lid

Berichten
3.771
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
voor return $readend; zet je $output = $readend[0];. en return $readend; zelf vervang je door return $output;

Oftewel:

// ## Gastenboek ## 
function getGast( $Home ) //Grab the Habbos motto 
{ 
    if ( !$Home ) 
    { 
        return false; 
    } 
    else 
    { 
        $explode = explode(<span id="guestbook-size">, $Home);
        $readend = explode(</span>, $explode[1]); 
        $output = $readend[0];
        return $output; 
    } 
}
0
Marvinn

Lid · Topicstarter

Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dankjewel smile
0
Fass

Lid

Berichten
3.771
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Graag gedaan xd
0
Tom

Lid

Berichten
3.868
Reputatie
0
Punten
0,02
Lid sinds
Laatst gezien
Ik vond je uitleg wel een beetje vaag, misschien dat je voortaan een betere uitleg geven?
0
Marvinn

Lid · Topicstarter

Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Sorry. bloos ik wist niet HOE ik het moest uitleggen schater
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Fassdfds schreef:
voor return $readend; zet je $output = $readend[0];. en return $readend; zelf vervang je door return $output;

Oftewel:

// ## Gastenboek ## 
function getGast( $Home ) //Grab the Habbos motto 
{ 
    if ( !$Home ) 
    { 
        return false; 
    } 
    else 
    { 
        $explode = explode(<span id="guestbook-size">, $Home);
        $readend = explode(</span>, $explode[1]); 
        $output = $readend[0];
        return $output; 
    } 
}
Die om 0 mag weg
Wordt dus:

// ## Gastenboek ## 
function getGast( $Home ) //Grab the Habbos motto 
{ 
    if ( !$Home ) 
    { 
        return false; 
    } 
    else 
    { 
        $explode = explode(<span id="guestbook-size">, $Home);
        $readend = explode(</span>, $explode[1]); 
        $output = $readend[0];
        return $output; 
    } 
}
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren