Jump to content

Read fsockopen result?


ruraldev

Recommended Posts

Can anyone help me print the output from fsockopen, I create a variable called $var

 

It returns an xml format

 

<tag>

    <element1>one</element1>

    <element2>two</element2>

    <element3>three</element3>

</tag>

 

I can output the values onetwothree using fputs and fgets but I need to be able to display just a single element, I am sure this is simple but I still can't work it out.

 

Hope someone can help.

 

Thanks

 

Gordon

Link to comment
https://forums.phpfreaks.com/topic/264294-read-fsockopen-result/
Share on other sites

Code is below, however it wouldn't work live as the remote machine is behind a firewall and only certain IP's are allowed through. It does get a response as I can see it but it is just a single long string.

 

You may well be correct that this is beyond my abilities!

 

 

$var = fsockopen($svr_add,$svr_port,$errno,$errstr,$svr_timeout);

 

if(!$var)

    {

    echo "Connextion Failed\n";

    exit();

    }

else

    {

fputs ($var, $xml_data);

 

echo fgets ($var, 128);

 

fclose($var);

    }

 

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.