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
https://forums.phpfreaks.com/topic/73598-using-curl-to-post-to-listening-ipport/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.