Hi all,
I'm new to php, I nned to do a simple conversion from asp.net into php.
Who knows how to convert this:
_____________________________________________________________________________________________________
Dim url As String = "http://www.mywebsite.com"
Dim wc As WebClient = New WebClient()
wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
' parameters - begin
Dim myQueryStringCollection As New System.Collections.Specialized.NameValueCollection()
myQueryStringCollection.Add("paramenter", paramenter)
wc.QueryString = myQueryStringCollection
' parameters - end
Dim myDatabuffer As Byte() = wc.DownloadData(url)
' Display the downloaded data.
Dim result As String = Encoding.ASCII.GetString(myDatabuffer)
wc.Dispose()
Response.Write(result)
_______________________________________________________________________________________
into php?
Many thanks.
Simple asp.net to php conversion
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Simple asp.net to php conversion
Just a guess because I am not sure what a number of those methods do:
Code: Select all
$url = "http://www.mywebsite.com";
$result = file_get_contents($url); // may not work in some configurations, so may need cURL or Snoopy
// you may want to filter the data here with htmlenitities(), etc. for security
header("Content-Type", "application/x-www-form-urlencoded");
echo $result;(#10850)