Jump to content
Sign in to follow this  
psantos10

[Dúvida] PHP + XML

Recommended Posts

psantos10

Prezados,

Tenho este URL:

https://example.com:2087/xml-api/createacct?username=myuser&plan=basic &ip=n&cpmod=x3&password=h@rd2gu3ss!p@ss&contact email=username @domain.tld&domain=domain.tld&useregns=0&reseller=0

Visitando este endereço, utilizando as variaveis certas, consigo obter algo como:

<createacct>

    <result>       

          <options>

                  <ip>192.168.1.1</ip>

                  <nameserver>ns1.domain.tld</nameserver>

                  <nameserver2>ns2.domain.tld</nameserver2>

                  <nameserver3/>

                  <nameserver4/>

                  <nameservera/>

                  <nameservera2/>

                  <nameservera3/>

                  <nameservera4/>

                  <nameserverentry/>

                  <nameserverentry2/>

                  <nameserverentry3/>

                  <nameserverentry4/>

                  <package>basic</package>

          </options>

          <rawout>

Checking input data...The ProFTPd configuration file /etc/proftpd.conf appears to be ok!

System has 0 free ips.

...Done

WWWAcct 12.1.0 © 1997-2008 cPanel, Inc....

Dns Zone check is enabled.

+===================================+

| New Account Info                  |

+===================================+

| Domain: domain.tld

| Ip: 208.77.188.166 (n)

| HasCgi: y

| UserName: myuser

| PassWord: h@rd2gu3ss!p@ss

| CpanelMod: x3

| HomeRoot: /home

| Quota: 0 Meg

| NameServer1: ns1.example.com

| NameServer2: ns2.example.com

| NameServer3: ns1.domain.com

| NameServer4:

| Contact Email: username@domain.tld

| Package: basic

| Feature List: default

| Language: english

+===================================+

...Done

Running pre creation script (/scripts/prewwwacct)......Done

Adding User...Removing Shell Access (n)

...Done

Copying skel files from /root/cpanel3-skel/ to /home/myuser/......Done

Adding Entries to httpd.conf......Done

Setting up Mail and Local Domains...localdomains...

valiases ...vdomainaliases...vfilters......Done

Configuring DNS...Bind reconfiguring on server1 using rndc

...Done

Restarting apache......Done

Changing password for myuser Password for myuser has been changed

Updating Authentication Databases...Updating ftp passwords for myuser

Ftp password files updated.

Ftp vhost passwords synced

...Done

Verifying MX Records and Setting up Databases......Done

Setting up Proxy Subdomains......Done

Bind reloading on server1 using rndc zone: [domain.tld]

Sending Account Information......Done

System has 0 free ips.

Running post creation scripts (/scripts/legacypostwwwacct,

/scripts/postwwwacct, /scripts/postwwwacctuser)......Done

wwwacct creation finished

Setting up Domain Pointers......Done

Setting Reseller Privs......Done

Account Creation Complete!!!...Account Creation Ok...Done

            </rawout>

            <status>1</status>

            <statusmsg>Account Creation Ok</statusmsg>

    </result>

</createacct>

Como posso com PHP apenas ler este trecho:

<status>1</status>

<statusmsg>Account Creation Ok</statusmsg>

Grato pela atenção


-------Assinatura?

Share this post


Link to post
Share on other sites
mAiN_iNfEcTiOn

Exacto...

Mas também podias obter os dados para uma variável, exemplo:

$string_xml = file_get_contents('http://servidor_exemplo.dom/ficheiro.xml');
$xml_obj = simplexml_load_string( $string_xml );

# TA DÃÃÃÃÃ
print_r( $xml_obj );

:D Mas a função simplexml_load_file()  funciona perfeitamente para o que pretendes :D

Share this post


Link to post
Share on other sites
psantos10

Exacto...

Mas também podias obter os dados para uma variável, exemplo:

$string_xml = file_get_contents('http://servidor_exemplo.dom/ficheiro.xml');
$xml_obj = simplexml_load_string( $string_xml );

# TA DÃÃÃÃÃ
print_r( $xml_obj );

:D Mas a função simplexml_load_file()  funciona perfeitamente para o que pretendes :D

quando executo este código recebo este erro:

Warning: file_get_contents(http://...@rd2gu3ss!p@ss&contact%20email=username%20@domain.tld&domain=domain.tld&useregns=0&reseller=0) [function.file-get-contents]: failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in D:\www\demo\curl\teste2.php on line 2

será que tem haver com o proxy da minha rede?

cumps

PS


-------Assinatura?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.