Page 2 of 2

Re: How to solve: XML Parsing Error: no element found

Posted: Mon Jun 07, 2010 9:28 am
by Jonah Bron
1. Yes, that's what he meant; on your computer

3. :google: http://lmgtfy.com/?q=php+curl

Re: How to solve: XML Parsing Error: no element found

Posted: Tue Jun 08, 2010 5:08 am
by plusnplus
Actually the script just can work without cURL installed right?

Re: How to solve: XML Parsing Error: no element found

Posted: Wed Jun 16, 2010 4:08 am
by plusnplus
is there any way to check in phpinfo() function, wheter the setting is correct or not?
I still get nothing from:
<?php
header("content-type: text/xml");
$xmlData = file_get_contents("http://www.google.com/ig/api?weather=new%20york");
echo $xmlData;
?>

thanks for any help/ info

Re: How to solve: XML Parsing Error: no element found

Posted: Wed Jun 16, 2010 5:10 am
by lalitchand
This message comes when server doesn't return any result.

Thanks,
Lalit

Re: How to solve: XML Parsing Error: no element found

Posted: Wed Jun 16, 2010 7:24 pm
by plusnplus
lalitchand wrote:This message comes when server doesn't return any result.

Thanks,
Lalit
hm..., you mean my server or url link server?
if you mean my server, then how to configure it correctly? setting apache.conf ?

if you mean url link server, you are wrong. because when i type direct(http://www.google.com/ig/api?weather=new%20york) in browser it give me result(xml file)

Re: How to solve: XML Parsing Error: no element found

Posted: Thu Jun 17, 2010 12:31 am
by lalitchand
I mean your link server ..
There are two possibilities .. either your Apache server is not configured correctly ..or
if your Apache server is behind some proxy.. then bypass this proxy server..

Hope it helps ..

Thanks,
Lalit

Re: How to solve: XML Parsing Error: no element found

Posted: Thu Jun 17, 2010 1:42 am
by plusnplus
lalitchand wrote:I mean your link server ..
There are two possibilities .. either your Apache server is not configured correctly ..or
if your Apache server is behind some proxy.. then bypass this proxy server..

Hope it helps ..

Thanks,
Lalit
Hi lalitchand,
yes, my apache server is behind some proxy.
How i bypass the proxy server?
I mean, where i should put the user id and password, in php script or apache conf ?

Re: How to solve: XML Parsing Error: no element found

Posted: Mon Jun 21, 2010 5:20 am
by lalitchand
Sorry for replying late..
you have to set proxy setting in your php file.

Code: Select all


curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_PROXY, "proxy_server");
curl_setopt($ch, CURLOPT_PROXYPORT, "port"); 

hope it helps.

Regards,
lalit

Re: How to solve: XML Parsing Error: no element found

Posted: Mon Jun 21, 2010 11:13 pm
by plusnplus
Hi lalitchand,

Thanks for try to help me.
is that curl in your script?
because i don't use curl in my php/ apache.

Re: How to solve: XML Parsing Error: no element found

Posted: Mon Jun 21, 2010 11:34 pm
by lalitchand
Please refer this link for better clarity.
http://developer.yahoo.com/javascript/howto-proxy.html

you cannot get access or data from public server because of security violations.

This link shed light on this problem.

Hope it helps.

Cheers

Re: How to solve: XML Parsing Error: no element found

Posted: Tue Jun 22, 2010 3:52 am
by plusnplus
now my problem is how to install curl in my php.
i did google, try and still no success.
here i get from googling:
-copy libeay32.dll and ssleay32.dll from the DLL folder of the PHP/ binary package to the SYSTEM folder of your Windows machine. (Ex: C:\WINNT\SYSTEM32 or C:\WINDOWS\SYSTEM) . Please also open you ?php.ini? file . (Ex: C:\WINNT\SYSTEM32 or C:\WINDOWS\SYSTEM) and
Change the line ?;extension=php_curl.dll?
To this ?extension=php_curl.dll?
-copy the libcurl.dll from the PHP program folder to C:\Windows\System32 and restart the Apache server
- i also have msvcr70.dll in my C:\WINNT\SYSTEM32


I can not see any info about curl in phpinfo()

Anyone have easy way/ guide to install curl ?

Re: How to solve: XML Parsing Error: no element found

Posted: Tue Jun 22, 2010 8:11 pm
by plusnplus
Hi lalitchand,

now i have curl in php.

how i combine this code:
header("content-type: text/xml");
$xmlData = file_get_contents("http://www.google.com/ig/api?weather=new%20york");
echo $xmlData;

with your code?
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_PROXY, "proxy_server");
curl_setopt($ch, CURLOPT_PROXYPORT, "port");

thanks for help me :)

Re: How to solve: XML Parsing Error: no element found

Posted: Wed Jun 23, 2010 1:20 am
by lalitchand

Code: Select all

<?php 
error_reporting(E_ALL);
header("content-type: text/xml");
$xmlData = file_get_contents("http://www.google.com/ig/api?weather=new%20york");
echo $xmlData;

function file_get_contents($url)
{
$ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
// put here your proxy server ip
curl_setopt($ch, CURLOPT_PROXY, "http://172.18.65.22:80");
// put here your proxy server port
curl_setopt($ch, CURLOPT_PROXYPORT, 80); 
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
?>
I think this script should run.
make sure curl is enabled ..
All d best

~Cheers

Re: How to solve: XML Parsing Error: no element found

Posted: Wed Jun 23, 2010 9:34 pm
by plusnplus
Hi lalitchand,

Thanks, it is work.