php connection using HttpWebRequest and Get method

Posted by Ahmet vardar on Stack Overflow See other posts from Stack Overflow or by Ahmet vardar
Published on 2010-04-26T06:08:16Z Indexed on 2010/04/26 6:13 UTC
Read the original article Hit count: 176

Filed under:
|

Hi,

i have a script returns some string,

http://mysite.com/script.php

php script;

 $data = $_GET['q'];

    $query = "SELECT * FROM `table` WHERE ID = '$data'";
$result = mysql_query($query);
$num = mysql_num_rows($result);

  print $num;

i want to connect this script with VB,

using this code

Dim con As String
        con = "http://mysite.com/script.php?q=" & My.Settings.setq

        Dim request = HttpWebRequest.Create(con)
        request.Method = "GET"
        Dim response = request.GetResponse()
        Using reader = New StreamReader(response.GetResponseStream())
           msgbox(reader.ReadToEnd())
        End Using

it is not working.

how can i do that ?

thanks

© Stack Overflow or respective owner

Related posts about vb

Related posts about beginner