Welcome to WebmasterWorld Guest from 54.163.68.15

Forum Moderators: phranque

Message Too Old, No Replies

Run php script from remote server

And pass username and password

   
8:42 am on Jan 10, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I need to call a php script to import data. I am doing this via VB.NET as follows


Dim myProcess As New System.Diagnostics.Process()
myProcess.StartInfo = New System.Diagnostics.ProcessStartInfo("iexplore.exe", "http://......./pages_system/datasync.php")
myProcess.Start()
myProcess.Kill()


I have put username and password on the php page but now the automation fails. Any ideas how to pass the credentials (LAMP) - any language will do ?

Thanks
2:58 pm on Jan 10, 2012 (gmt 0)

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Are you saying that you have secured the PHP script on the remote server and it requires authentication first before it will respond to the http request?
10:04 pm on Jan 10, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, thats right when I navigate to it manually it now prompts me to logon.
5:39 pm on Jan 12, 2012 (gmt 0)

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



I do not know how to do this in ASP or .NET but what I do when I need to post to a site like that is open a socket connection and handle the transaction on the server side. So your VB.NET server talks to the remote PHP-enabled server via a socket connection. A handy tool for this is cURL. Rather than open and control the socket and communication you can use the cURL API's for your particular server platform.
4:01 pm on Jan 20, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think thats what the .net code is doing, somewhere beneath the TCP/IP layers in the .net line of code a socket is being created to the remote server...

I just need to figure out how to pass credentials to authenticate when challenged by the server, in any language - PHP, .Net, cURL
3:48 pm on Feb 2, 2012 (gmt 0)

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



The basics are laid out in the text docs on the cURL site:
[curl.haxx.se...]
and searching for something like "curl post login" or variations on that search should turn up some examples you could follow to get started. Wish I could offer more my friend.