www.webdeveloper.com
Results 1 to 6 of 6

Thread: http_get

  1. #1
    Join Date
    Feb 2011
    Posts
    90

    http_get

    Hi,
    if I want to use http_get in order to do the following get request:
    http://example.com?user=bob&password=password


    should it look like?:
    Code:
    $result=http_get("http://www.example.com/", array("user"=>"bob","password"=>"password"), $info);
    or like:
    Code:
    $result=http_get("http://example.com?user=bob&password=password", , $info);

  2. #2
    Join Date
    Jan 2009
    Posts
    3,346
    The second one would be passing the get vars. I'm not sure what would happen if you did it the first way...but I would imagine you would get an error.

  3. #3
    Join Date
    Feb 2011
    Posts
    90
    Quote Originally Posted by criterion9 View Post
    The second one would be passing the get vars. I'm not sure what would happen if you did it the first way...but I would imagine you would get an error.
    ok thanks.

  4. #4
    Join Date
    Jan 2006
    Location
    MN
    Posts
    440
    or

    $user = $_GET['user'];
    $password = $_GET['password'];

  5. #5
    Join Date
    Feb 2011
    Posts
    90
    Quote Originally Posted by Dasher View Post
    or

    $user = $_GET['user'];
    $password = $_GET['password'];
    and then what?

    how should the http_get command look like?

  6. #6
    Join Date
    Jan 2006
    Location
    MN
    Posts
    440
    If what you are trying to do is extract variables from a url there is no need to use http_get. Just use the global variable $_GET[].

    One should also sanitize the input. So maybe this would be better;

    $user = mysql_escape_string($_GET['user']);
    $password = mysql_escape_string($_GET['password']);

    On the other hand one does not normally want to expose user names and passwords in plain text in a url. Hopefully those are only examples of what you are trying to do.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles