thanks, have updated to this, but unfortunately still not working:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,
"http://121.98.150.62:5574/Invoice?txtcode=R5W2" );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HTTPHEADER,array('Expect:'));
$xmlresponse = curl_exec($ch );
echo curl_error($ch);
echo $xmlresponse;
///any other ideas?
On Fri, Aug 20, 2010 at 5:15 PM, Nathan Kennedy
<[email protected]> wrote:
> I had exactly the same headache earlier this week. I found there are two
> things to look out for:
>
> For this line: curl_setopt($ch, CURLOPT_POSTFIELDS, $post_str) - is
> $post_str an array or a string? Both are acceptable, but if an array then
> curl with automatically set the header "Content-Type: multipart/form-data".
> This is what turned out to be the issue in my case.
>
> The other thing is the Expect header. Not all servers like this, so try the
> following to prevent it: curl_setopt($ch, CURLOPT_HTTPHEADER,
> array('Expect:'));
>
> If all else fails, try replicating the headers that your browser would be
> sending. This includes headers such as USER_AGENT and REFERER.
>
> HTH.
>
> Nathan.
>
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf
> Of Brendan Brink
> Sent: Friday, 20 August 2010 4:58 p.m.
> To: [email protected]
> Subject: [phpug] CURL issue
>
> hi there,
>
> any CURL experts out there?
>
> I use CURL successfully in PHP for processing external pages and
> havent had any issues before.
>
> However today have the following issue:
>
> This the URL i am trying to get info from through CURL:
>
> http://121.98.150.62:5574/Invoice?txtcode=R5W2
>
> When you go to this URL directly, works fine and displays the XML.
>
> However, when I try and address this URL through CURL as follows, I do
> not capture a response.
>
> PHP CODE BELOW
>
> $ch = curl_init();
>
> curl_setopt($ch, CURLOPT_URL,
> "http://121.98.150.62:5574/Invoice?txtcode=R5W2" );
> curl_setopt($ch, CURLOPT_POST, TRUE);
> curl_setopt($ch, CURLOPT_POSTFIELDS, $post_str);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
>
> $xmlresponse = curl_exec($ch );
> echo $xmlresponse; //this displays nothing and an
> error when trying
> to import the XML
> //extract xml
>
> $dom = new domDocument;
> $dom->loadXML($xmlresponse);
> if (!$dom) {
> echo 'Error while parsing the document';
>
> $returninfo['status'] = 0;
> return $returninfo;
>
> }
>
> $s = simplexml_import_dom($dom);
>
>
>
> Greatly appreciate anyones help - sorry for a late Friday email!
>
> --
> 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]