hi there Nathan, thanks for that...
i tried the file_get_contents and got the following error: Warning: file_get_contents(http://121.98.150.62:5574/MENU.XML) [function.file-get-contents]: failed to open stream: Connection refused in /home/textvouchers/textvouchers/sell2cellltd/smartpanel/2326/testcurl.php on line 5 maybe its an issue with the php server where my scripts are executed oN? On Fri, Aug 20, 2010 at 11:51 PM, Nathan Kennedy <[email protected]> wrote: > Hi Brendan, > > I threw the below code into a test script on my own server and it worked > once I commented out the SERVER_PORT line. You can see it here: > http://admin.teleduino.com/curl.php > > If you're just doing a simple GET request, you may find that there is a much > easier solution than using cURL. Have you taken a look at the > file_get_contents() function? > > Try the following: > > $xml = file_get_contents('http://121.98.150.62:5574/MENU.XML'); > echo $xml; > > Thanks, > Nathan. > > -----Original Message----- > From: [email protected] [mailto:[email protected]] On Behalf > Of Brendan Brink > Sent: Friday, 20 August 2010 11:16 p.m. > To: [email protected] > Subject: Re: [phpug] cURL IP address > > Hi there all, > > this is the code i currently have: > > $theurl = "http://121.98.150.62:5574/MENU.XML"; > > $ch = curl_init(); > //curl_setopt( $ch, CURLOPT_HTTPHEADER, > array("REMOTE_ADDR: $ip", > "HTTP_X_FORWARDED_FOR: $ip")); > > curl_setopt($ch, CURLOPT_URL, $theurl ); > curl_setopt($ch, CURLOPT_HEADER, 1); > curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); > curl_setopt($ch, CURLOPT_PORT, > $_SERVER['SERVER_PORT']); > echo "SERVER PORT: ".$_SERVER['SERVER_PORT']; > //curl_setopt($ch, > CURLOPT_HTTPHEADER,array('Expect:')); > $xmlresponse = curl_exec($ch ); > echo curl_error($ch); > echo $xmlresponse;curl_close($ch); > > can anyone see any errors as to why curl is not getting the xml from the > url? > > On Fri, Aug 20, 2010 at 11:10 PM, Brendan Brink > <[email protected]> wrote: >> hi there, >> >> i did not get Bruce's latest suggestion? thought he got mixed up >> thinking he was on the LINUX list... >> >> On Fri, Aug 20, 2010 at 11:02 PM, Jochen Daum <[email protected]> wrote: >>> Hi Brendan, >>> On Fri, Aug 20, 2010 at 10:47 PM, Brendan Brink > <[email protected]> >>> wrote: >>>> >>>> hi there again, >>>> >>>> have not been able to go to the host PC to change the file, but been >>>> thinking about it and not sure you are on the same page as I am >>>> regarding this. >>>> >>>> the script i am writing is on my server, and i am addressing a clients > PC. >>>> >>>> they are running a point of sale system which is addressed using that IP >>>> number. >>>> >>>> I need to address the client PC on the fly through my script using >>>> CURL and obtain the XML. >>>> >>>> I dont think the 'test' url will work if the script on my server is >>>> trying to address the client's PC... >>>> >>>> let me know if you understand what I am trying to do... >>> >>> If you wanted to change the hosts file, you would have to do it on the >>> server - yes. But as I said I think there is little prospect in trying > this >>> because it is likely not the problem. Have you tried Bruce's latest >>> suggestion? It looks much more promising. >>> HTH, Jochen >>> >>>> >>>> On Fri, Aug 20, 2010 at 9:27 PM, Jochen Daum <[email protected]> wrote: >>>> > Hi Brendan, >>>> > On Fri, Aug 20, 2010 at 9:15 PM, Brendan Brink >>>> > <[email protected]> >>>> > wrote: >>>> >> >>>> >> hi there Jochen, >>>> >> >>>> >> So from what you say below... >>>> >> >>>> >> I need to update the hosts file on the PC at the IP address to set > the >>>> >> IP address to a line of text... >>>> >> >>>> >> and then I can curl the line of text as I would a normal URL from my >>>> >> script? >>>> > >>>> > Well, maybe do the hosts file change just to check it is not the > problem >>>> > - I >>>> > highly doubt it. Your url with the port would look like this (its > really >>>> > search and replace your IP address): >>>> > http://test:5574/Invoice?txtcode=R5W2 >>>> > >>>> >> >>>> >> What about the PORT number would it work ok? >>>> >> >>>> >> The IP address is the address of my customers POS system, I need to >>>> >> CURL it to obtain the XML from my website script. >>>> >> >>>> > >>>> > Really the problem is that the server looks at one of your browser >>>> > headers >>>> > that is missing and doesn't return the request. So you need to figure >>>> > out >>>> > how to add custom headers to your curl request and see if that fixes > the >>>> > problem. >>>> > Keep us posted. >>>> > >>>> >> >>>> >> Sorry if my query seems ignorant, but I am not familiar with the >>>> >> technologies you are talking about. >>>> > >>>> > No worries, just take it step by step. >>>> > HTH, Jochen >>>> > >>>> > -- >>>> > NZ PHP Users Group: http://groups.google.com/group/nzphpug >>>> > To post, send email to [email protected] >>>> > To unsubscribe, send email to >>>> > [email protected] >>>> >>>> -- >>>> Kind Regards, >>>> >>>> Brendan Brink >>>> >>>> SMS Marketing Consultant | Manager >>>> Sell2Cell Ltd. >>>> >>>> 021 0246 1646 | [email protected] | www.sell2cell.co.nz >>>> >>>> >>>> >>>> >>>> We provide customized, cost-effective SMS & Web Solutions >>>> Need a website? Need to integrate text-messaging into your business >>>> or website? Contact us today for a free no-obligation quote! >>>> >>>> VISIT OUR ASSOCIATED WEBSITES: textvouchers.com | textguru.co.nz >>>> >>>> WARNING This email contains information which is CONFIDENTIAL and may >>>> be subject to LEGAL PRIVILEGE. If you are not the intended recipient, >>>> you must not peruse, use, disseminate, distribute or copy the email or >>>> attachments. If you have received this in error, please notify us >>>> immediately by return email, facsimile, or telephone (call us >>>> collect). >>>> >>>> -- >>>> NZ PHP Users Group: http://groups.google.com/group/nzphpug >>>> To post, send email to [email protected] >>>> To unsubscribe, send email to >>>> [email protected] >>> >>> -- >>> NZ PHP Users Group: http://groups.google.com/group/nzphpug >>> To post, send email to [email protected] >>> To unsubscribe, send email to >>> [email protected] >> >> -- >> Kind Regards, >> >> Brendan Brink >> >> SMS Marketing Consultant | Manager >> Sell2Cell Ltd. >> >> 021 0246 1646 | [email protected] | www.sell2cell.co.nz >> >> >> >> >> We provide customized, cost-effective SMS & Web Solutions >> Need a website? Need to integrate text-messaging into your business >> or website? Contact us today for a free no-obligation quote! >> >> VISIT OUR ASSOCIATED WEBSITES: textvouchers.com | textguru.co.nz >> >> WARNING This email contains information which is CONFIDENTIAL and may >> be subject to LEGAL PRIVILEGE. If you are not the intended recipient, >> you must not peruse, use, disseminate, distribute or copy the email or >> attachments. If you have received this in error, please notify us >> immediately by return email, facsimile, or telephone (call us >> collect). >> > > > > -- > Kind Regards, > > Brendan Brink > > SMS Marketing Consultant | Manager > Sell2Cell Ltd. > > 021 0246 1646 | [email protected] | www.sell2cell.co.nz > > > > > We provide customized, cost-effective SMS & Web Solutions > Need a website? Need to integrate text-messaging into your business > or website? Contact us today for a free no-obligation quote! > > VISIT OUR ASSOCIATED WEBSITES: textvouchers.com | textguru.co.nz > > WARNING This email contains information which is CONFIDENTIAL and may > be subject to LEGAL PRIVILEGE. If you are not the intended recipient, > you must not peruse, use, disseminate, distribute or copy the email or > attachments. If you have received this in error, please notify us > immediately by return email, facsimile, or telephone (call us > collect). > > -- > NZ PHP Users Group: http://groups.google.com/group/nzphpug > To post, send email to [email protected] > To unsubscribe, send email to > [email protected] > > -- > NZ PHP Users Group: http://groups.google.com/group/nzphpug > To post, send email to [email protected] > To unsubscribe, send email to > [email protected] -- Kind Regards, Brendan Brink SMS Marketing Consultant | Manager Sell2Cell Ltd. 021 0246 1646 | [email protected] | www.sell2cell.co.nz We provide customized, cost-effective SMS & Web Solutions Need a website? Need to integrate text-messaging into your business or website? Contact us today for a free no-obligation quote! VISIT OUR ASSOCIATED WEBSITES: textvouchers.com | textguru.co.nz WARNING This email contains information which is CONFIDENTIAL and may be subject to LEGAL PRIVILEGE. If you are not the intended recipient, you must not peruse, use, disseminate, distribute or copy the email or attachments. If you have received this in error, please notify us immediately by return email, facsimile, or telephone (call us collect). -- NZ PHP Users Group: http://groups.google.com/group/nzphpug To post, send email to [email protected] To unsubscribe, send email to [email protected]
