Jump to content

pranvkavi

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

pranvkavi's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Using the following htaccess, I have been able to rewrite site.com/profile.php?username=xyz to site.com/xyz, RewriteEngine On RewriteRule ^([a-zA-Z0-9_-]+)$ profile.php?user=$1 RewriteRule ^([a-zA-Z0-9_-]+)/$ profile.php?user=$1 Adding the following to the above, RewriteRule ^([a-zA-Z0-9_-]+)/section$ section.php?user=$1 RewriteRule ^([a-zA-Z0-9_-]+)/section/$ section.php?user=$1 did not resolve site.com/section.php?username=xyz to site.com/xyz/section. Am I doing anything wrong here?
  2. I am trying to figure out how we can run a html file within a php script.
  3. I have a CURL code that fetches some XML content from a remote server. I get the expected output on my localhost (XAMPP on windows). But from the live site(hosted on Linux), I get the CURL error:'couldn't connect to host'. function DownloadUrl($Url, $p){ // is curl installed? if (!function_exists('curl_init')){ die('CURL is not installed!'); } // create curl resource $ch = curl_init(); // set url curl_setopt($ch, CURLOPT_URL, $Url); curl_setopt ($ch, CURLOPT_POSTFIELDS, $p); curl_setopt ($ch, CURLOPT_POST, 1); //return the transfer as a string curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // $output contains the output string $output = curl_exec($ch); if($output === false) echo 'Curl error: ' . curl_error($ch); else print $output; // close curl resource to free up system resources curl_close($ch); }
  4. $data = '%3C?xml%20version=%221.0%22%20encoding=%22ISO-8859-%22?%3E%3C!DOCTYPE%20 MESSAGE%20SYSTEM%20%22http://127.0.0.1/psms/dtd/messagev12.dtd.dtd%22%20%3E%3CMESSAGE%3E%3CUSER%20USERNAME=%22username%22%20PASWORD=%22XXXXX%22/%3E%3CSMS%20%20UDH=%220%22%20CODING=%221%22%20TEXT=%22The%20flight%20%23&btnG;%20<101>%20"DEL"%20to%20"BLR"%20is%20delayed%20and%20it's%20%20revised%20time%20will%20be%20informed%20later.%20Have%20a%20nice%20day!%22%20PROPERTY=%220%22%20ID=%221%22%3E%3CADDRESS%20FROM=%22919902202099%22%20TO=%22919886094024%22%20SEQ=%221%22%20TAG=%22some%20clientside%20random%20data%22%20/%3E%3C/SMS%3E%3C/MESSAGE%3E'; $url = "http://api.myvaluefirst.com/psms/servlet/psms.Eservice2"; $ch = curl_init(); // initialize curl handle curl_setopt($ch, CURLOPT_URL,$url); // set url to post to curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable curl_setopt($ch, CURLOPT_TIMEOUT, 5); // times out after 4s curl_setopt($ch, CURLOPT_POST, 1); // set POST method curl_setopt($ch, CURLOPT_POSTFIELDS, "data="+($data)+"&action=send"); // add POST fields $result = curl_exec($ch); // run the whole process curl_close($ch); echo $result;
  5. For a particular SMS application, I am supposed to send the following XML content to an external URL. <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE MESSAGE SYSTEM "http://127.0.0.1/psms/dtd/message.dtd" > <MESSAGE> <USER USERNAME="mycompany" PASSWORD="mycompany"/> <SMS UDH="0" CODING="1" TEXT="hey this is a real test" PROPERTY="" ID="1" DLR="0" VALIDITY="0"> <ADDRESS FROM="9812345678" TO="919812345678" SEQ="1" TAG="some client side random data" /> </SMS> </MESSAGE> When I send it through a simple HTTP POST(form submit), it seems to work fine. The recipient(s) recieves the message. But if I replicate the same procedure through CURL, the external url gives that the XML send does not conform to DTD. The XML content is urlencoded before being sent through CURL. Is there a difference between a CURL POST and a normal HTTP POST that can cause the above problem?? I could really use some help....
×
×
  • Create New...

Important Information

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.