473,386 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

accessing web service...

hi,

i was given a query string : http://mywebservice.com?url=<xurl where
xurl=is a valid url. now what the query string does it will display an
xml on the page. like this one:

<?xml version="1.0" encoding="UTF-8" ?>
<response...>
..
..
..
</response>

how can i trap the response using curl?

Jun 26 '07 #1
5 1437
this is how i did it but i got no reply...

$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,$xgo);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$xresult=curl_exec($ch);

echo var_dump($xresult);

what to do to trap the response?

Jun 26 '07 #2
On Jun 26, 4:43 am, shotokan99 <soft_devj...@yahoo.comwrote:
this is how i did it but i got no reply...

$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,$xgo);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$xresult=curl_exec($ch);

echo var_dump($xresult);

what to do to trap the response?
"no" reply, nothing, just hung?
is this a firewall issue, does the remote site accept requests from
the user agent, does the remote session require a cookie,

was it indeed "no reply"
were there headers - use a proxy to find out.
have you encoded the url in the get paramater properly.
have you tried it locally returning static xml, debug locally then set
it free.

Jun 26 '07 #3
On Jun 26, 5:03 am, shimmyshack <matt.fa...@gmail.comwrote:
On Jun 26, 4:43 am, shotokan99 <soft_devj...@yahoo.comwrote:
this is how i did it but i got no reply...
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,$xgo);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$xresult=curl_exec($ch);
echo var_dump($xresult);
what to do to trap the response?

"no" reply, nothing, just hung?
is this a firewall issue, does the remote site accept requests from
the user agent, does the remote session require a cookie,

was it indeed "no reply"
were there headers - use a proxy to find out.
have you encoded the url in the get paramater properly.
have you tried it locally returning static xml, debug locally then set
it free.
oh and I suppose its worth asking, do you have cURL on your system at
all, try it from the command line?

Jun 26 '07 #4
i modified it using this code:
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,$xgo);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$xresult=curl_exec($ch);

echo var_dump($xresult);

the response is: httpstatus 403
>have you encoded the url in the get paramater properly.
have you tried it locally returning static xml, debug locally then set
it free.
yes. im completely sure that my parameters entries are 100% ok,
because i run it straight to the browser address bar and it gives a
valid xml response. i have no firewall issue becuase i tried to run
xml before and it was doin ok. the only difference to what i did
before is, im passing a formatted xml and this time the request is
done thru query string.


Jun 26 '07 #5
On Jun 26, 5:08 am, shotokan99 <soft_devj...@yahoo.comwrote:
i modified it using this code:
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,$xgo);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$xresult=curl_exec($ch);

echo var_dump($xresult);

the response is: httpstatus 403
have you encoded the url in the get paramater properly.
have you tried it locally returning static xml, debug locally then set
it free.

yes. im completely sure that my parameters entries are 100% ok,
because i run it straight to the browser address bar and it gives a
valid xml response. i have no firewall issue becuase i tried to run
xml before and it was doin ok. the only difference to what i did
before is, im passing a formatted xml and this time the request is
done thru query string.
since you get a 403, you're right the data is going both ways so the
firewall doesnt seem to be a factor.
But remember I guess you were using a browser before, now you are
using php, that makes things completely different, I'm not sure what
you mean when you say that "the only difference to what i did before
is, im passing a formatted xml and this time the request is done thru
query string" - have you tried doing this in a browser, are you sure
it is acceptable, 403 means forbidden after all.
My guess would be that you are required to do things that a browser
does, change the user agent, and start accepting cookies, so that cURL
looks more like a browser, and finally send and receive the data just
as the browser does. You aren't far off, but remember that most web
services (free ones) wouldn't like to be thrashed by a program and may
well have retrictions - if it has a howto follow compltetly to the
letter, but you should be alright with just mimicking what works, cURL
can do it just required a few more options and tweaks.

Jun 26 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Keith E. | last post by:
I have implemented a Web Service on an IIS 5.0 platform using the ASP listener I can access the Web Service just fine from a VB 6 App and classic ASP using the SOAP 3.0 toolkit and its...
4
by: Eugen Walcher | last post by:
Hello all, I've tried posting this same question on other newsgroups with no luck. This group seems to have a lot more activity so I apologize if you have seen it before. I'm trying to...
1
by: Eirik Brattbakk | last post by:
Hi I have some problems accessing a soap service made in c# using an ATL/MFC client over SSL. I have tried both CSoapMSXMLInetClient and CSoapWininetClient as template arguments with my stub...
3
by: Jim Lewis | last post by:
I have read several things that state accessing a Web Service through a Query String should work. However, when I try to execute http://localhost/webservice1/service1.asmx/HelloWorld I get the...
7
by: David Laub | last post by:
I've also posted this issue to a Sun/java formum, but since it appears to be an integration issue, this may be the better place to posr: I have written a dot net/c# Web Services doesn't fully...
4
by: Khalique | last post by:
I have built a web service whose purpose is to copy files from a secure place to client machine and vice versa. The problem I am having is perhaps related to permissions and access rights. For...
3
by: Olivier BESSON | last post by:
Hello, I have a web service of my own on a server (vb.net). I must declare it with SoapRpcMethod to be used with JAVA. This is a simple exemple method of my vb source : ...
4
by: Jon | last post by:
I wrote a VS 2005 C# express programme that accesses a web service. It works fine when there's a direct connection to the internet, but on two different PCs with internet access via a proxy, I get...
10
by: Anton | last post by:
Hi, when accessing a secured 3rd party webservice i'm getting a 401 HTTP Statuscode (unauthorized). When entering the url in a browser and entering the username and password manually, the wsdl is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.