Hi guys,
I am using managed c++/cli. I have a trouble with my code, I cannot be able to grab the html tags from my website using with httprequest.
Here's the html tags:
PHP Code:
<a href="delete.php?test=test&id=1">Delete</a> </td>
Here's the current code:
Code:
try
{
Form1 ^form1 = dynamic_cast<Form1 ^>(Owner);
//Address of URL
String ^URL = "http://mysite.com/members.php?user=" + form2->label1->Text + "&pass=" + form2->label2->Text;
HttpWebRequest ^request = safe_cast<HttpWebRequest^>(WebRequest::Create(URL));
HttpWebResponse ^response = safe_cast<HttpWebResponse^>(request->GetResponse());
StreamReader ^reader = gcnew StreamReader(response->GetResponseStream());
String ^str = reader->ReadToEnd();
String ^pattern1 = form1->ListView1->SelectedItems[0]->Text + "</p><p id=\"delete\"> <a href=\"delete.php\\?delete.php?test=test&id=(.*?)\">";
Match ^m1 = Regex::Match(str, pattern1);
MatchCollection ^matches1 = Regex::Matches(str, pattern1);
for each (Match ^x1 in matches1)
{
MessageBox::Show("test 1");
array<String^> ^StrArr1 = x1->Value->ToString()->Split();
String ^test = (URL + x1->Value->ToString()->Replace(form1->ListView1->SelectedItems[0]->Text, "")->Replace("</p><p id=\"delete\"> <a href=\"", "")->Replace("\"" + ">", ""));
MessageBox::Show(test);
}
}
catch (Exception ^ex)
{
}
Do you know why and what's wrong?
Any advice would be much appreciated.
Thanks,
Mark