|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Fetching XML data from URL
Hello all,
I am using this code: PHP Code:
Now... i get this error: Code:
There was a problem parsing your XML! New xml() object instantiated. fetch() called. XML error: SYSTEM or PUBLIC, the URI is missing at line 3 What does that error mean? how can i fix it? The same code works fine for other URL (from other distributor). Thank you! |
|
#2
|
|||
|
|||
|
This would only be a guess because the service is password protected and I can't view what the result of the file_get_contents call, but like the error says, this link is failing to return a URI for this call... since the others work, you should echo out the contents of $source_artikli for one that works, then this one, and see what the differences are.
|
|
#3
|
|||
|
|||
|
hm.... i tried... and i get this:
Code:
http://nemesis-hr.net/gameover/update-asbis.php But i should be getting some XML .. for example like this... Example: to get invoices for the period from May 10 till May 20 of year 2007: Code:
https://www.it4profit.com/login/authorize2.jsp?USERNAME=User_ID&PASSWORD=User_Password&REFPAGE=%2Flite%2FInvoiceList.jsp%3F%26DATE_FROM=1 0/05/2007%26DATE_TILL=20/05/2007%26COMP_CODE=709 Invoice XML description. Code:
<Invoice> <InvoiceNumber /> <InvoiceDate>20/03/2007</InvoiceDate> <CurrencyCode>USD</CurrencyCode> <OrderNumber /> <OrderRefNumber>154574</OrderRefNumber> <OrderRefID>70320105817218119</OrderRefID> <TotalAmount>2146.75</TotalAmount> <VAT>0.0000</VAT> <TotalAmountWithVAT>2146.7500</TotalAmountWithVAT> <ItemList> <Item> <LineKey>70320105817647299</LineKey> <ItemCode>CN-HDD35250</ItemCode> <SKU>CNHDD35250</SKU> <Qty>25</Qty> <Price>85.87</Price> <VAT>0.0000</VAT> <PriceWithVAT>85.8700</PriceWithVAT> </Item> </ItemList> </Invoice> System Admin from IT4Profit told me to use that URL which I am Using! Thank you! |
|
#4
|
|||
|
|||
|
Ok i solved my problem!! THANKS for TIP!
but now i have other prob i have XML file size = 5.6MB and i read that file with: Code:
if (!$y->fetch($source_artikli)) { ...
but i get server error: Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 35 bytes) How is that posible if the file is only 5mb? When i do echo $source_artikli i get normal results... thank you! |
|
#5
|
|||
|
|||
|
4,194,3040 bytes is about 4mb, so you can only open approx 4mb file (4,718,592 is read as 4.5mb (from a file on my hdd)).
So something is limiting you to 4mbs files.
__________________
~~==~~ Whoever said nothing is impossible never tried pushing a revolving door ~~==~~ |
|
#6
|
|||
|
|||
|
Ok.. i manage to avoid that problem ^_^
now i have this problem (seems like i have only problems i fetch xml data with this: PHP Code:
But why do i get results like this: Code:
<br />2213700-RASC-29320LPE_SGLbravo<br />bravo<br />Ukupno artikala:2 When the XML file is: Code:
<CONTENT> <COMP_CODE>709</COMP_CODE> <LANG>hr</LANG> <COMP_CODE_BUYER>80530085911858417</COMP_CODE_BUYER> <SEARCH_CODE></SEARCH_CODE> <MANUFACTURER_NAME></MANUFACTURER_NAME> <TYPE_NAME></TYPE_NAME> <PRICES> <PRICE> <WIC>2213700-R</WIC> <DESCRIPTION>ADAPTEC Battery Module 500 Backup Battery Lithium Ion</DESCRIPTION> <VENDOR_NAME>ADAPTEC</VENDOR_NAME> <GROUP_NAME>Power - Battery</GROUP_NAME> <VPF_NAME>Battery Module 500</VPF_NAME> <CURRENCY_CODE>HRK</CURRENCY_CODE> <AVAIL>0</AVAIL> <RETAIL_PRICE>722.10</RETAIL_PRICE> <MY_PRICE>664.33</MY_PRICE> <WARRANTYTERM>12</WARRANTYTERM> <GROUP_ID>103</GROUP_ID> <VENDOR_ID>3</VENDOR_ID> <PICT_SMALL>http://www.it4profit.com/catalogimg/wic/1/2213700-R</PICT_SMALL> <ITEM_LINK>http://content.it4profit.com/itshop/itemcard_cs.jsp?ITEM=51108132711259053&THEME=asbis&LANG=hr</ITEM_LINK> </PRICE> <PRICE> <WIC>ASC-29320LPE_SGL</WIC> <DESCRIPTION>Controller ADAPTEC SCSI 29320LPE Ultra320 SCSI PCI Express X1 1ch</DESCRIPTION> <VENDOR_NAME>ADAPTEC</VENDOR_NAME> <GROUP_NAME>Controller Card</GROUP_NAME> <VPF_NAME>SCSI 29320LPE</VPF_NAME> <CURRENCY_CODE>HRK</CURRENCY_CODE> <AVAIL>0</AVAIL> <RETAIL_PRICE>1160.00</RETAIL_PRICE> <MY_PRICE>1038.20</MY_PRICE> <WARRANTYTERM>36</WARRANTYTERM> <GROUP_ID>110</GROUP_ID> <VENDOR_ID>3</VENDOR_ID> <PICT_SMALL>http://www.it4profit.com/catalogimg/wic/1/ASC-29320LPE_SGL</PICT_SMALL> <ITEM_LINK>http://content.it4profit.com/itshop/itemcard_cs.jsp?ITEM=70313123403415873&THEME=asbis&LANG=hr</ITEM_LINK> </PRICE> </PRICES> </CONTENT> So i Should be getting resoults like: <br />2213700-Rbravo <br />ASC-29320LPE_SGLbravo <br />Ukupno artikala:2 ?? WHat am i doing wrong please? thank you very much |
|
#7
|
|||
|
|||
|
well I don't know a lot about XML, but it looks like it thinks that the two <WIC> tags are infact one string, so it sees it as 2213700-RASC-29320LPE_SGL instead of 2213700-R & ASC-29320LPE_SGL.
But thats the limit of my contribution. I also don't know where its getting bravo from or Ukupno artikala:2 from, as I can't see that in the XML file you've shown Last edited by Osiris : December 2nd, 2008 at 07:29 AM. |
|
#8
|
|||
|
|||
|
Sorry,this is the full code i pasted short one ^^
PHP Code:
even if i put all data from XML to echo.. WIC, Group Name etc... i get all data in one string... but i use same script on other XML file.... i get normal output... but when i fix script to work on other XML file.. i get this bug,error or what ever it is... thank you |
|
#9
|
|||
|
|||
|
What does it look like when you echo out the XML file? Can you post it up?
|
|
#10
|
|||
|
|||
|
Echo it with
PHP Code:
or you mean something else? You have the whole XML file in post above... ty |
|
#11
|
|||
|
|||
|
So when you echo out the XML file, as in echo $source_artikli;, it just shows
Code:
<CONTENT> <COMP_CODE>709</COMP_CODE> <LANG>hr</LANG> <COMP_CODE_BUYER>80530085911858417</COMP_CODE_BUYER> <SEARCH_CODE></SEARCH_CODE> <MANUFACTURER_NAME></MANUFACTURER_NAME> <TYPE_NAME></TYPE_NAME> <PRICES> <PRICE> <WIC>2213700-R</WIC> <DESCRIPTION>ADAPTEC Battery Module 500 Backup Battery Lithium Ion</DESCRIPTION> <VENDOR_NAME>ADAPTEC</VENDOR_NAME> <GROUP_NAME>Power - Battery</GROUP_NAME> <VPF_NAME>Battery Module 500</VPF_NAME> <CURRENCY_CODE>HRK</CURRENCY_CODE> <AVAIL>0</AVAIL> <RETAIL_PRICE>722.10</RETAIL_PRICE> <MY_PRICE>664.33</MY_PRICE> <WARRANTYTERM>12</WARRANTYTERM> <GROUP_ID>103</GROUP_ID> <VENDOR_ID>3</VENDOR_ID> <PICT_SMALL>http://www.it4profit.com/catalogimg/wic/1/2213700-R</PICT_SMALL> <ITEM_LINK>http://content.it4profit.com/itshop/itemcard_cs.jsp?ITEM=51108132711259053&THEME=asbis &LANG=hr</ITEM_LINK> </PRICE> <PRICE> <WIC>ASC-29320LPE_SGL</WIC> <DESCRIPTION>Controller ADAPTEC SCSI 29320LPE Ultra320 SCSI PCI Express X1 1ch</DESCRIPTION> <VENDOR_NAME>ADAPTEC</VENDOR_NAME> <GROUP_NAME>Controller Card</GROUP_NAME> <VPF_NAME>SCSI 29320LPE</VPF_NAME> <CURRENCY_CODE>HRK</CURRENCY_CODE> <AVAIL>0</AVAIL> <RETAIL_PRICE>1160.00</RETAIL_PRICE> <MY_PRICE>1038.20</MY_PRICE> <WARRANTYTERM>36</WARRANTYTERM> <GROUP_ID>110</GROUP_ID> <VENDOR_ID>3</VENDOR_ID> <PICT_SMALL>http://www.it4profit.com/catalogimg/wic/1/ASC-29320LPE_SGL</PICT_SMALL> <ITEM_LINK>http://content.it4profit.com/itshop/itemcard_cs.jsp?ITEM=70313123403415873&THEME=asbis &LANG=hr</ITEM_LINK> </PRICE> </PRICES> </CONTENT> Last edited by Osiris : December 2nd, 2008 at 08:55 AM. |
|
#12
|
|||
|
|||
|
what happens if you change
foreach ($y->data->CONTENT[0]->PRICES[0]->PRICE as $var) to foreach ($y->data->CONTENT[0]->PRICES[0]->PRICE[] as $var) notice the [] at the end of PRICE. It might make no difference whatsoever :p But from what I can see your code should be working. Oh also, when I put your xml file into my own one it throughs an error about expected semicolon ';' for the <ITEM_LINK> lines, If I remove them then it works fine. So I don't know if an error with your XML file is causing this bug Last edited by Osiris : December 2nd, 2008 at 11:21 AM. |
|
#13
|
|||
|
|||
|
i get
PHP Code:
^_^ got some other idea?... i will check xml file for errors... |
|
#14
|
|||
|
|||
|
Code:
But from what I can see your code should be working. Oh also, when I put your xml file into my own one it throughs an error about expected semicolon ';' for the <ITEM_LINK> lines, If I remove them then it works fine. So I don't know if an error with your XML file is causing this bug I deleted ITEM_LINK lines but error is still here |
|
#15
|
|||
|
|||
|
Well trying to help lol, but having problem with your code :p
PHP Code:
its saying that $source_artikli is not an object, and I don't know how to get around that :p |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > Fetching XML data from URL |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|