NYCPHP Meetup

NYPHP.org

[nycphp-talk] Fedex Server Telnet

David Roth davidalanroth at gmail.com
Sun Aug 19 11:10:01 EDT 2012


On Sun, Aug 19, 2012 at 10:13 AM, Nicholas Hart <pelhamny at gmail.com> wrote:

> Hi,
>
> I am trying to write a PHP front end for the Fedex Server which uses
> telnet to send/receive shipping data.  I am hoping that someone has already
> done this and can tell me how to send/receive this telnet data in PHP as I
> am having some trouble with it.  The string of data is made up of numeric
> 'options' and a quoted value pairs.
>
> String data format:
> Send:  0,"020"1,"119999"4,"Jon Doe"....  ,"01"99,""
> Recv:  0,"120"1,"119999"10,"232593318"...  ,"00"99,""
>
> The strings always start with 0,  and end with  99,""
>
> Any suggestions welcome.  Many thanks.
>
> Nick
>
>
Hi Nick.

I needed to do something similar to this. I wrote a shell script to telnet
to (I think it was a Linksys) router to obtain it's IP address.

# cat getip.sh
  (
    sleep 3
    echo "USERNAME"
    sleep 1
    echo "PASSWORD"
    sleep 1
    echo "ifconfig clink0"
    sleep 1
    echo "exit"
   ) | telnet 192.168.1.1 2>/dev/null | grep netmask | awk ' { print $1 } '
| sed 's/ip=//g' | sed 's/,//g'

The above shell script does a login using telnet to the router, enters a
command, parses the output and returns the IP address.You could write a
shell script like the above, and call it with exec() in PHP to get the
output and parse it.

Does the Fedex Server have anything else available to interface with this
data such as REST or SOAP so it could return XML format data to you?

David Roth
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20120819/1361e173/attachment.html>


More information about the talk mailing list