Hi,
I am trying to write to a file the output from an http GET request, however the file is not completely written and I can see the following message Resource id #55 about half way through writing the file.
Here is my code
the output of this code is
I also want to retain the original formatting
Appreciate any help in this regards,
Thanks,
Tewari
I am trying to write to a file the output from an http GET request, however the file is not completely written and I can see the following message Resource id #55 about half way through writing the file.
Here is my code
Code:
$filename = "orderDet_".$x."xml";
$requestURL = "[URL unfurl="true"]https://services.abc.com/Labcenter/G[/URL]
etOrderXML.asp?mlrfnbr=1109&order=".$x."&password=";
$response = file_get_contents($requestURL);
$fp = fopen($requestURL, "r");
$contents = fread($fp, 1000);
fclose($fp);
//echo $request;
$fp1 = fopen($filename, "w", strlen($requestURL));
$write = fputs($fp1, $contents);
fputs($fp1, $fp);
fclose($fp1);
the output of this code is
Code:
<?xml version="1.0" standalone="yes"?>^M
<?xm-well_formed path = ""?>^M
<Order ID="801">^M
<OrderTime>2006-09-30 12:08:35</OrderTime>^M
<Dealer Name="Circle Graphics"><Street1>test</Street1><Street2></Street2><City>test</Cit
y><State>CO</State><ZIP>80302</ZIP><Country>USA</Country><MerchantID>58</MerchantID><LocationNot
e></LocationNote></Dealer><Portal Name=""/><Customer ID="kmcdonal@hotmail.com"><First>Ken</First
><Last>McDonald</Last><BillTo><First>Ken</First><Last>McDonald</Last><Street1>Marketing Stuffers
</Street1><Street2>LifePics</Street2><City>boulder</City><State>CO</State><ZIP>80301</ZIP><Phone
>(303)413-9500 249</Phone><Country>USA</Country></BillTo><ShipTo><First>Ken</First><Last>McDonal
d</Last><Street1>Marketing Stuffers</Street1><Street2>LifePics</Street2><City>boulder</City><Sta
te>CO</State><ZIP>80301</ZIP><Phone>(303)413-9500 249</Phone><Country>USA</Country><Comment>Ship
via UPS : Ground</Comment></ShipTo></Customer><SpecialInstructions><Message></Message></Special
InstructioResource id #55
Appreciate any help in this regards,
Thanks,
Tewari