According to a comment on the relevant php manual page
http://php.net/manual/en/function.curl-setopt.php

"If you get an "CURLE_COULDNT_CONNECT /* 7 */" error, try adding the
port : (for example)

<?php curl_setopt($ch, CURLOPT_PORT, $_SERVER['SERVER_PORT']); ?>"



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?
>
> 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.
>
> Sorry if my query seems ignorant, but I am not familiar with the
> technologies you are talking about.
>
>
>
> On Fri, Aug 20, 2010 at 8:27 PM, Jochen Daum <[email protected]> wrote:
>> Hi,
>>
>> On Fri, Aug 20, 2010 at 8:17 PM, Brendan Brink
>> <[email protected]> wrote:
>>> Hi there Jochen,
>>>
>>> Thanks for your assistance.
>>>
>>> However am not familiar with host file entrys etc.
>>
>> On linux there is a file /etc/hosts. On Windows, there is a file
>> c:\windows\system32\drivers\etc\hosts (careful to open as admin user,
>> otherwise you get it created in your user directory)
>>
>> Both variants take a line with an IP address, multiple spaces and a
>> line of text (the DNS name)
>>
>> 10.0.0.1 test
>>
>> If you open in your browser http://test it gives exactly the same
>> result as opening http://10.0.0.1
>>
>>> Is there a PHP function I can use to perform these and call the URL
>>> mentioned below?
>>
>> no. Use notepad/nano
>>
>>> If you put it in the URL address, it returns XML as it should.
>>>
>>> Just need a way to call this from a PHP script and store the XML to a
>>> variable...
>>
>> yes, but the server at this address looks at some other information
>> apart from the URL as well. If I open this url:
>>
>> http://121.98.150.62:5574/Invoice?txtcode=R5W2
>>
>> I get an XML file, but my browser sends the following request headers:
>>
>> Host: 121.98.150.62:5574
>> User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8)
>> Gecko/20100723 Ubuntu/10.04 (lucid) Firefox/3.6.8
>> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
>> Accept-Language: en-us,en;q=0.5
>> Accept-Encoding: gzip,deflate
>> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
>> Keep-Alive: 115
>> Connection: keep-alive
>>
>>
>> If you send all these request headers as well, then the server won't
>> be able to distinguish your curl client from the browser client. If
>> you need to see what headers curl actually sends, you can try
>> Wireshark (though it will require a bit of time to get your head
>> around it)
>>
>> 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]
>



-- 
Bruce Clement

Home:    http://www.clement.co.nz/
Twitter:    http://twitter.com/Bruce_Clement
Google Buzz: http://www.google.com/profiles/aotearoanz

"Before attempting to create something new, it is vital to have a good
appreciation of everything that already exists in this field." Mikhail
Kalashnikov

-- 
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]

Reply via email to