1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Sockets and web sites

Discussion in 'Mac Programming' started by collinssol, Oct 15, 2009.

  1. macrumors newbie

    I want to make a mac app that listens on a port for incoming data and a web page send that data and the app processes it then send the processed data back to the web site. I have a program running that well accept incoming data on port 50000 but only if i send said information through the URL IE xxx.xxx.xx.x:50000/user=fred,number=123456789

    I can rack this in and process it and get the user and number out but thats not exactly what i want. I need to send this data via php or java and then when i get the processed data back do some php scripting with it. I am new to mac app development and have hit a brick wall. I have tried php sockets and curl as well as some java httprequest and nothing works. My program never picks up a request unless its the browser making the call.

    I would really appreciate any help or advice i can get.
  2. macrumors 6502

    I think you're going to have to be a bit more clear about what you are trying to do. Are users sending the data to port 50000? What do you mean when you say that you need to send this data via php or java?
  3. macrumors newbie

    I have a form that a person fills out auction information like ebay auction number then i had php code that would retrieve that information via the ebay api and add that auction to the shopping cart of the particular web site. My code has been pretty popular but i have had some compatibility issues so i was wanting to take the ebay processing off to a server side program that would accept the form data and reply with the action information that the rest of to code would interact by adding it to the cart database.
  4. macrumors 6502

    My guess is that there is something wrong with your request that is causing your program to not pick it up. In PHP you might use something like this library instead of raw sockets so that you don't have to worry about the low-level protocol details. They have some pretty good examples on their examples page.

    I think you would be better off writing your server-side program as a PHP script and having a standard webserver deal with all of the request handling. The webserver that the user uses and the server-side backend processing webserver don't have to be the same (or even on the same machine) if that is an issue.
  5. macrumors newbie

    thanks for the info rows. i have been hammering on this awhile now and i have the program pickup up data by sending the data in the address via xmlhttprequest. I am having trouble pickup back up the response though. My goal is to have a program that process data in the same way my sellable script does now. I have some compatibility issues with some customers servers so i am trying to get the bulk of the processing off onto my server so i can control the main code and make it easier to maintain and update and i will not have to worry as much about having different versions for the multitude of server configurations out there.

    I am trying to get data out of a form, process that data and get information back from the server that i can plug into a php statement. I have been using the simple http server example from the apple dev center as the basis of my work. I have thought about starting from scratch and see if that helps with my sending data back problem.

Share This Page