Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
PHP- Curl Help needed, to desplay result of curl session
Old 07-08-2009, 01:23 PM PHP- Curl Help needed, to desplay result of curl session
Junior Talker

Posts: 1
Trades: 0
Hello,
I made a curl which send some data to a url and the result of script should be displayed.
the script looks like this
Code:
<?php 

// Initialize curl 
$ch = curl_init(); 


// Get curl to POST 
curl_setopt($ch, CURLOPT_POST, 1); 
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

// Instruct curl to suppress the output from Online Mart, and to directly  
// return the transfer instead.  (Output will be stored in $txResult.) 
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); 

// This is the location of the Online Mart payment gateway 
 

 //https://www.beanstream.com/scripts/process_transaction.asp
 curl_setopt( $ch, CURLOPT_URL, "https://www.beanstream.com/scripts/process_transaction.asp" ); 
// These are the transaction parameters that we will POST 
 $merchant_id=117489490;
 $trnCardOwner="Ashutosh";
 $trnCardNumber=4030000010001234;
 $trnExpMonth=09;
 $trnExpYear=20;
 $trnCardCVD=567;
 $trnOrderNumber=2234;
 $trnAmount=30.00;
 $ordEmailAddress="gpt.ashutosh@gmail.com";
 $ordName="Ashutosh";
 $ordPhoneNumber=9988776655;
 $ordAddress1="1045 Main street";
 $ordCity="Vancouver";
 $ordProvince="BC";
 $ordPostalCode="V8R1J6";
 $ordCountry="CA";
 $ash="requestType%3dT%26merchant_id%3d%22.%24merchant_id.%22%26trnCardOwner%3d%22.%24trnCardOwner.%22%26trnCardNumber%3d%22.%24trnCardNumber.%22%26trnExpMonth%3d%22.%24trnExpMonth.%22%26trnExpYear%3d%22.%24trnExpYear.%22%26trnOrderNumber%3d%22.%24trnOrderNumber.%22%26trnAmount%3d%22.%24trnAmount.%22%26ordEmailAddress%3d%22.%24ordEmailAddress.%22%26ordName%3d%22.%24ordName.%22%26ordPhoneNumber%3d%22.%24ordPhoneNumber.%22%26ordAddress1%3d%22.%24ordAddress1.%22%26ordAddress2%3d%22.%24ordAddress2.%22%26ordCity%3d%22.%24ordCity.%22%26ordProvince%3d%22.%24ordProvince.%22%26ordPostalCode%3d%22.%24ordPostalCode.%22%26ordCountry%3d%22.%24ordCountry.%22";
 /*echo curl_setopt( $ch, CURLOPT_POSTFIELDS,"requestType=BACKEND&merchant_id=117489490&trnCardOwner=Paul+Randal&trnCardNumber=4030000010001234&trnExpMonth=01&trnExpYear=05&trnOrderNumber=2232&trnAmount=10.00&ordEmailAddress=prandal@mydomain.net&ordName=Paul+Randal&ordPhoneNumber=9999999&ordAddress1=1045+Main+Street&ordAddress2=&ordCity=Vancouver&ordProvince=BC&ordPostalCode=V8R+1J6&ordCountry=CA&approvedPage=payment_success.php?msg=success&declinedPage=payment_success.php?msg=declined" );*/

curl_setopt( $ch, CURLOPT_POSTFIELDS,$ash); 

// Now POST the transaction.  $txResult will contain Online Mart's response 
$txResult = curl_exec($ch); 

echo "Result:<BR>"; 
echo $txResult; 
curl_close( $ch ); 


?>
It's showing the output as blank , See : http://ashutosh4u.100webspace.net/Hu...a/curl_api.php
Can some one help, need help urgently
lihen is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-08-2009, 06:44 PM Re: PHP- Curl Help needed, to desplay result of curl session
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
It works, i fact.
When I run it from my place, I have an
Code:
string(37) "Invalid merchant id (merchant_id = 0)"
when I do a var_dump() of the result.
__________________
Only a biker knows why a dog sticks his head out the window.

Last edited by tripy; 07-08-2009 at 06:45 PM..
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Reply     « Reply to PHP- Curl Help needed, to desplay result of curl session
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.26735 seconds with 12 queries