I am trying to use my first xml document, the documentation is not very good I am afraid, I see where I can put in the info I need to into the xml document, but I do not see anywhere where I would post the data to the url on the other side, I have the url I need to post to but how do I post the info to that url. I will list the example xml code they gave me below. I am asuming I would just use that instead of the normal html I would use.
<?xml version="1.0" ?><request version="1.0" id="REQUEST-123456">
<reseller id="987654321">
<password>secret</password>
<plan-id>7</plan-id>
</reseller>
<add-domain fqdn="domain1.com">
<password>secret</password>
<organization>Organization</organization>
<ns priority="1" fqdn="ns1.domain1.com">
<ip>10.10.10.20</ip>
</ns>
<ns priority="2" fqdn="ns1.reseller.com">
<ip>10.20.30.40</ip>
</ns>
<contact type="admin">
<first-name>Joe</first-name>
<last-name>Smith</last-name>
<organization>Organization</organization>
<address>
<street>10350 Barnes Canyon Rd.</street>
<city>San Diego</city>
<state>CA</state>
<postalcode>92121</postalcode>
<country>USA</country>
</address>
<voice>+1 (858) 410-6900
</voice>
<email>[email protected]</email>
</contact>
<registration-period>2</registration-period>
</add-domain>
<modify-domain fqdn="domain2.com">
<password>secret</password>
<ns priority="2" fqdn="ns1.domain2.com">
<ip>100.100.100.200</ip>
</ns>
</modify-domain>
<delete-domain fqdn="domain3.com">
<password>secret</password>
</delete-domain>
</request>
I can change anything I want in that code in my PHP but how do I post that to the url? Also is this a complete document that I would use, or is there more tags that need added? I noticed there was no xml?> tag.look up xml_parse() in the manual.Ok, I looked that up at php.net and also read a good bit there but I am compleatly lost as to how to send info from my page to their url.
Do you have any simple examples where I would take a piece of xml and post it to a url?
Thankshow are you posting it to the url? xml is a docuemnt, nothing to do with the url.
it will have to be a POST not a GET adn you have to send them the file, not in the url.I am trying to integrate my website with a domain registar so that I can register domain names right from my site, their api specifies that I have to post the request info from my site to theres in an xml post, I will paste that part of the manual below:
2.1 Pirin Process
Pirin utilizes Open Source Interface to provide Partner authentication, domain requests validity check, register, modify or delete domain name. The process is:
2.1.1. Sending request
The Partner POSTs an XML data stream with his request.
2.1.2. Authentication
The Partner provides his registration number and password with each request.
2.1.3. Validity check
All domain registration, modification or deletion requests are checked for validity.
2.1.4. Request execution
All requests in the 鎻礱tch?are executed and status for every one of them is saved.
2.1.5. Names4Ever response
An XML data stream with response is posted.
I can see how I collect the data through my php scripts and make the xml document from the examples they have, but I cannot find anywhere how I take the xml document and get it to them, the url I am sopposed to post it to is a https url. It tells me I am supposed to POST and XML Data stream but there is no examples of it, all the examples they have are with perl and asp on a windows machine and I am working with php on a linux server.hmm, then I have no idea. I am not real big into xml yet. but am real curious if you find an answer.
maybe Rydberg or illogique would know.I think I might be getting closer, I have seen a couple of examples where they are using fsockopen() I am going to try to pass the xml data through fsockopen to their https site, I have not had the time to try that yet, now I just have to figure where their post back will come, I don't see where I can tell them what page to post back to, but I guess one thing at a time.Well I figured out how to post the xml stream to the external url, now I just have to figure out how to parse the results, I know how I can but I think there must be a simple way, I will post my code below for posting the xml stream:
<?
$filename = "/home/web/sites/threadaweb/test.xml";
$fd = fopen ($filename, "r");
$len = filesize($filename);
$fp = fsockopen("www.names4ever.com", 80);
$path = "/PirinLink/PirinTest.exe";
fputs($fp, "POST ".$path." HTTP/1.0\n");
fputs($fp, "Content-type: text/xml\n");
fputs($fp, "Content-length: $len");
fputs($fp, "\n\r\n");
while (!feof ($fd)) {
$buf = fgets($fd);
$data = fputs($fp, "$buf");
}
while (!feof($fp)) {
$reply .= fgets($fp, 128);
}
fclose($fp);
fclose ($fd);
?>
<? echo $reply ?>
The xml file is the same code I posted in my first post in this thread.the results should be a regualr POST variable. just use the global $_POST and it should work.Actually the $reply variable in the script I posted is the xml stream back from the external url, I just need to process the xml stream that is in the $reply variable to get the info I need, you can see the stream if you go to:
<!-- m --><a class="postlink" href="http://www.threadaweb.com/xmltest.php">http://www.threadaweb.com/xmltest.php</a><!-- m --> and view the source.the reply woudl contain your answer but you can reply on POST to get your info
if (!strcmp ($reply, "something that verifies")){
if (!strcmp ($reply, "something that says invalid.")){
but I am not sure which one you want. or what you are looking for that says verified ot valid.I think I might make a function that will break apart their reply and do a bunch of string searches, I need to know the <status> code first and if it is not "0" then I need to know the error, Depending on the error will determine what my script does next, one of the problems of just looking for a certain thing in the reply is that there may be 10 or 15 <status> codes in one reply, the example I showed was a simple one, so I am just going to try to break it apart into something workable by the rules I see they have.
After I am done building my client I will probably clean it up make it a bit more generic and release it open source, I see there are a couple of domain resellers that use the same API but everything is written for asp on a windows server and I could find no documentation on using it on linux in PHP so I will try to release what I have found.
I also try to post the stuff that works to boards like this so people doing google searches can find a compleate example that works I agree.
I use a somewhat same code. I get response from Paypal like that and that is the code I use to find out if the credit card was verified or denied.
so you might have to make a function to get all the info you want. make sure you get all of the denied or the verified codes you need.
<?xml version="1.0" ?><request version="1.0" id="REQUEST-123456">
<reseller id="987654321">
<password>secret</password>
<plan-id>7</plan-id>
</reseller>
<add-domain fqdn="domain1.com">
<password>secret</password>
<organization>Organization</organization>
<ns priority="1" fqdn="ns1.domain1.com">
<ip>10.10.10.20</ip>
</ns>
<ns priority="2" fqdn="ns1.reseller.com">
<ip>10.20.30.40</ip>
</ns>
<contact type="admin">
<first-name>Joe</first-name>
<last-name>Smith</last-name>
<organization>Organization</organization>
<address>
<street>10350 Barnes Canyon Rd.</street>
<city>San Diego</city>
<state>CA</state>
<postalcode>92121</postalcode>
<country>USA</country>
</address>
<voice>+1 (858) 410-6900
</voice>
<email>[email protected]</email>
</contact>
<registration-period>2</registration-period>
</add-domain>
<modify-domain fqdn="domain2.com">
<password>secret</password>
<ns priority="2" fqdn="ns1.domain2.com">
<ip>100.100.100.200</ip>
</ns>
</modify-domain>
<delete-domain fqdn="domain3.com">
<password>secret</password>
</delete-domain>
</request>
I can change anything I want in that code in my PHP but how do I post that to the url? Also is this a complete document that I would use, or is there more tags that need added? I noticed there was no xml?> tag.look up xml_parse() in the manual.Ok, I looked that up at php.net and also read a good bit there but I am compleatly lost as to how to send info from my page to their url.
Do you have any simple examples where I would take a piece of xml and post it to a url?
Thankshow are you posting it to the url? xml is a docuemnt, nothing to do with the url.
it will have to be a POST not a GET adn you have to send them the file, not in the url.I am trying to integrate my website with a domain registar so that I can register domain names right from my site, their api specifies that I have to post the request info from my site to theres in an xml post, I will paste that part of the manual below:
2.1 Pirin Process
Pirin utilizes Open Source Interface to provide Partner authentication, domain requests validity check, register, modify or delete domain name. The process is:
2.1.1. Sending request
The Partner POSTs an XML data stream with his request.
2.1.2. Authentication
The Partner provides his registration number and password with each request.
2.1.3. Validity check
All domain registration, modification or deletion requests are checked for validity.
2.1.4. Request execution
All requests in the 鎻礱tch?are executed and status for every one of them is saved.
2.1.5. Names4Ever response
An XML data stream with response is posted.
I can see how I collect the data through my php scripts and make the xml document from the examples they have, but I cannot find anywhere how I take the xml document and get it to them, the url I am sopposed to post it to is a https url. It tells me I am supposed to POST and XML Data stream but there is no examples of it, all the examples they have are with perl and asp on a windows machine and I am working with php on a linux server.hmm, then I have no idea. I am not real big into xml yet. but am real curious if you find an answer.
maybe Rydberg or illogique would know.I think I might be getting closer, I have seen a couple of examples where they are using fsockopen() I am going to try to pass the xml data through fsockopen to their https site, I have not had the time to try that yet, now I just have to figure where their post back will come, I don't see where I can tell them what page to post back to, but I guess one thing at a time.Well I figured out how to post the xml stream to the external url, now I just have to figure out how to parse the results, I know how I can but I think there must be a simple way, I will post my code below for posting the xml stream:
<?
$filename = "/home/web/sites/threadaweb/test.xml";
$fd = fopen ($filename, "r");
$len = filesize($filename);
$fp = fsockopen("www.names4ever.com", 80);
$path = "/PirinLink/PirinTest.exe";
fputs($fp, "POST ".$path." HTTP/1.0\n");
fputs($fp, "Content-type: text/xml\n");
fputs($fp, "Content-length: $len");
fputs($fp, "\n\r\n");
while (!feof ($fd)) {
$buf = fgets($fd);
$data = fputs($fp, "$buf");
}
while (!feof($fp)) {
$reply .= fgets($fp, 128);
}
fclose($fp);
fclose ($fd);
?>
<? echo $reply ?>
The xml file is the same code I posted in my first post in this thread.the results should be a regualr POST variable. just use the global $_POST and it should work.Actually the $reply variable in the script I posted is the xml stream back from the external url, I just need to process the xml stream that is in the $reply variable to get the info I need, you can see the stream if you go to:
<!-- m --><a class="postlink" href="http://www.threadaweb.com/xmltest.php">http://www.threadaweb.com/xmltest.php</a><!-- m --> and view the source.the reply woudl contain your answer but you can reply on POST to get your info
if (!strcmp ($reply, "something that verifies")){
if (!strcmp ($reply, "something that says invalid.")){
but I am not sure which one you want. or what you are looking for that says verified ot valid.I think I might make a function that will break apart their reply and do a bunch of string searches, I need to know the <status> code first and if it is not "0" then I need to know the error, Depending on the error will determine what my script does next, one of the problems of just looking for a certain thing in the reply is that there may be 10 or 15 <status> codes in one reply, the example I showed was a simple one, so I am just going to try to break it apart into something workable by the rules I see they have.
After I am done building my client I will probably clean it up make it a bit more generic and release it open source, I see there are a couple of domain resellers that use the same API but everything is written for asp on a windows server and I could find no documentation on using it on linux in PHP so I will try to release what I have found.
I also try to post the stuff that works to boards like this so people doing google searches can find a compleate example that works I agree.
I use a somewhat same code. I get response from Paypal like that and that is the code I use to find out if the credit card was verified or denied.
so you might have to make a function to get all the info you want. make sure you get all of the denied or the verified codes you need.