Jump to content

Using cUrl to POST to listening IP/port


tate_etc

Recommended Posts

i need to handle CSV requests/responses for two FedEx products

 

  • FedEx Web Integrated Solutions - requests are posted to a remote FedEx host
  • FedEx Ship Manager Server - requests are posted to a local listening IP/port

 

i have successfully posted to WIS using the cUrl method as shown:

 

$ch = curl_init();

curl_setopt($ch, CURLOPT_PORT, $port);

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

curl_setopt($ch, CURLOPT_TIMEOUT, 30);

curl_setopt($ch, CURLOPT_URL, $server);

$reply = curl_exec($ch);

curl_close($ch);

echo $reply;

 

i used the following as my vars. as you can see, i send the request to a URL:

 

$server = "https://gatewaybeta.fedex.com/GatewayDC";

$port = "443";

$data = "csv,'data',goes,'here'";

 

finally, this is what i'm trying to accomplish. i would like to post a CSV transaction to a local IP/port that is running the FedEx Ship Manager like this:

 

$server = "127.0.0.1";

$port = "2000";

$data = "csv,'data',goes,'here'";

 

when i use the vars above, the script times out. i have several programs that access FSMS with Java socket classes, so i know that the port is open. all of the software is hosted on the same PC, so there aren't any network issues to worry about...

 

i would like to know if this is the proper way to submit data to a listening port via PHP. i'm not sure if i should even be using cUrl; according to the PHP manual, cUrl accepts HTTP, HTTPS, FTP, GOPHER, TELNET, DICT, FILE, and LDAP protocols. FSMS is built on Java, and there isn't very much documentation on the software (only 900 or so customers use it).

 

does anyone have any suggestions? please help!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.