ext. URL aufrufen ohne fopen

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • ext. URL aufrufen ohne fopen

    Hallo,

    ich steh vor einem Problem und weiß nicht weiter. Ich muss für die Aktion eines Scriptes Werte via HTTP an ein Script auf einem anderen Server übermitteln.

    fopen wäre zwar eine Möglichkeit, doch möchte ich nicht wirklich die Serverkonfiguration ändern und eine mögliche Sicherheitslücke öffnen.

    Wie kann ich da noch vorgehen via PHP?

    Danke,

    Christoph

  • #2
    Das ist das bisherige Script:

    PHP-Code:
    <?
    $user = "xxxxxx";
    $password = "xxxxx";
    $api_id = "xxxxxx";
    $baseurl ="http://api.xxxxxxx.com";
    $text = urlencode("Das ist eine Text-Nachricht");
    $to = "xxxxxxxx";
    // auth call
    $url = "$baseurl/http/auth?user=$user&password=$password&api_id=$api_id";
    // do auth call
    $ret = file($url);
    // split our response. return string is on first line of the data returned
    $sess = split(":",$ret[0]);
    if ($sess[0] == "OK") {
    $sess_id = trim($sess[1]); // remove any whitespace
    $url = "$baseurl/http/sendmsg?session_id=$sess_id&to=$to&text=$text";
    // do sendmsg call
    $ret = file($url);
    $send = split(":",$ret[0]);
    if ($send[0] == "ID")
    echo "success<br>message ID: ". $send[1];
    else
    echo "send message failed";
    } else {
    echo "Authentication failure: ". $ret[0];
    exit();
    }
    ?>

    Kommentar


    • #3
      Anderer Befehl für &quot;fopen&quot;

      Hallo,

      http://www.php-resource.de/forum/sho...threadid=53128

      Sorry an die Admins, weis nicht wie ich auf die idee gekommen bin das ganze in "Brainstorming" reinzuschreiben ;-)

      Kommentar


      • #4
        unterlasse bitte crosspostings

        *zusammenführ*
        INFO: Erst suchen, dann posten![color=red] | [/color]MANUAL(s): PHP | MySQL | HTML/JS/CSS[color=red] | [/color]NICE: GNOME Do | TESTS: Gästebuch[color=red] | [/color]IM: Jabber.org |


        Kommentar


        • #5
          PHP-Code:
          ret shell_exec('lynx '.$url.' '.$args); 
          Fürs richtige $args siehe "man lynx".
          Zuletzt geändert von onemorenerd; 12.04.2005, 20:43.

          Kommentar


          • #6
            Hm... habs jetzt eingebaut, geht aber nicht:

            PHP-Code:
            $url "$baseurl/http/auth?user=$user&password=$password&api_id=$api_id";
            // do auth call
            // $ret = file($url);
            // split our response. return string is on first line of the data returned
            $sess split(":",$ret[0]);
            if (
            $sess[0] == "OK") {
            $sess_id trim($sess[1]); // remove any whitespace
            $url "$baseurl/http/sendmsg?session_id=$sess_id&to=$to&text=$text";
            // do sendmsg call
            shell_exec('lynx '.$baseurl.'/http/sendmsg?api_id='.$api_id.'&user='.$user.'&password='.$password.'
            &session_id='
            .$sess_id.'&to='.$to.'&text='.$text);
            }
            ?> 

            Kommentar

            Lädt...
            X