Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

UploadString

1 réponse
Avatar
Clem
Bonjour,

j'ai le code HTML suivant :

<form action="http://www.pagesjaunes.com.tn/search1.php" method="POST">
<table width="410" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td width="360" bgcolor="#ffffcc" valign="center">
<table width="360" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td align="right" valign="center"><font
class="page"><b>Activité</b></font></td>
<td width="100"><input type="text" NAME="Activity" size="25"
value="ASSOCIATIONS"></td>
</tr>
<tr>
<td align="right" valign="center"><font
class="page"><b>Gouvernorat</b></font></td>
<td colspan="4"><select name="Gouv"><option value="1"
>ARIANA</option></select></td>
</tr>
<tr>
<td align="left" colspan="4"><input type="image"
src="pics/fr_bt_search.gif"></td>
</tr>
</table>
</td>
</tr>
</table>
</form>

Comment faire pour utiliser la methode WebClient.Upload String ? en
utilisant la méthode Upload String, j'ai toujours 'Serveur indisponible'
comme réponse, alors que si j'execute mon code html dans mon navigateur,
j'obtiens bien un résultat.

J'ai essayé en faisant

WebClient RsWebClient;

RsWebClient.Encoding = System.Text.Encoding.UTF8;

String TxtRes =
RsWebClient.UploadString("http://www.pagesjaunes.com.tn/search1.php?Activity=ASSOCIATIONS&Gouv=1",
"");

puis

String TxtRes =
RsWebClient.UploadString(http://www.pagesjaunes.com.tn/search1.php,
"Activity=ASSOCIATIONS&Gouv=1");

puis

String TxtRes =
RsWebClient.UploadString("http://www.pagesjaunes.com.tn/search1.php",
"Activity=ASSOCIATIONS Gouv=1");

mais rien a faire...



merci bcp de m'éclairer !! ;)

1 réponse

Avatar
Paul Bacelar
Vous mélangiez adresse et données.

Si vous regardez attentivement l'exemple de MSDN
http://msdn2.microsoft.com/fr-fr/library/0645045y(VS.80).aspx, cela donne


String TxtRes =
RsWebClient.UploadString("http://www.pagesjaunes.com.tn/search1.php&quot" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.pagesjaunes.com.tn/search1.php&quot" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.pagesjaunes.com.tn/search1.php&quot" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.pagesjaunes.com.tn/search1.php&quot;,
"Activity = ASSOCIATIONS Gouv = 1");

Je n'ai pas testé, mais l'example est clair et simple :-)
--
Paul Bacelar
MVP VC++

"Clem" wrote in message
news:4603e5cd$0$27410$
Bonjour,

j'ai le code HTML suivant :

<form action="http://www.pagesjaunes.com.tn/search1.php&quot" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.pagesjaunes.com.tn/search1.php&quot" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.pagesjaunes.com.tn/search1.php&quot" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.pagesjaunes.com.tn/search1.php&quot; method="POST">
<table width="410" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td width="360" bgcolor="#ffffcc" valign="center">
<table width="360" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td align="right" valign="center"><font
class="page"><b>Activité</b></font></td>
<td width="100"><input type="text" NAME="Activity" size="25"
value="ASSOCIATIONS"></td>
</tr>
<tr>
<td align="right" valign="center"><font
class="page"><b>Gouvernorat</b></font></td>
<td colspan="4"><select name="Gouv"><option value="1"
>ARIANA</option></select></td>
</tr>
<tr>
<td align="left" colspan="4"><input type="image"
src="pics/fr_bt_search.gif"></td>
</tr>
</table>
</td>
</tr>
</table>
</form>

Comment faire pour utiliser la methode WebClient.Upload String ? en
utilisant la méthode Upload String, j'ai toujours 'Serveur indisponible'
comme réponse, alors que si j'execute mon code html dans mon navigateur,
j'obtiens bien un résultat.

J'ai essayé en faisant

WebClient RsWebClient;

RsWebClient.Encoding = System.Text.Encoding.UTF8;

String TxtRes =
RsWebClient.UploadString("http://www.pagesjaunes.com.tn/search1.php?Activity=ASSOCIATIONS&Gouv=1&quot" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.pagesjaunes.com.tn/search1.php?Activity=ASSOCIATIONS&Gouv=1&quot;,
"");

puis

String TxtRes =
RsWebClient.UploadString(http://www.pagesjaunes.com.tn/search1.php,
"Activity=ASSOCIATIONS&Gouv=1");

puis

String TxtRes =
RsWebClient.UploadString("http://www.pagesjaunes.com.tn/search1.php&quot" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.pagesjaunes.com.tn/search1.php&quot" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.pagesjaunes.com.tn/search1.php&quot" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.pagesjaunes.com.tn/search1.php&quot;,
"Activity=ASSOCIATIONS Gouv=1");

mais rien a faire...



merci bcp de m'éclairer !! ;)