Click here to Skip to main content
15,885,914 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Quote:
Anyone there can helps me to test my USSD PHP application on Dev Space Simulator? Because I'm not able to test my USSD application on my local machine with Dev space Simulator that I downloaded on this link: https://devspace.hsenidmobile.com/code/php/ussd/,

My application has two files: index.php and recall.php located in this path: C:\xampp\htdocs\ideamart


Quote:
My index.php code
<?php
header('Content-type:application/json'); 
$inputJson = file_get_contents('php://input'); 
$input = json_decode($inputJson,TRUE);
?>
<?php 
include 'recall.php';
?>


Quote:
recall.php
<?php
$data['meesage']='Dialog Idea Mart Welcome..';
$data["applicationId"] = $input["applicationId"]; 
$data["password"] = "password";
$data["version"]="1.0";
$data["sessionId"]= $input["sessionId"];
$data["ussdOperation"]="mt-cont";
$data["destinationAddress"]= $input["sourceAddress"];
$data["encoding"]="440";
$data["chargingAmount"]="5";
$json_string = json_encode($data);
$ideamartURL = "http://localhost:7000/ussd/send";

$ch = curl_init($ideamartURL); 
$options = array (
CURLOPT_RETURNTRANSFER => true, 
CURLOPT_HTTPHEADER => array('Content-type : application/json'); 
CURLOPT_POSTFIELDS => $json_string);

curl_setopt_array($ch,$options); 
$result = curl_exec($ch);
?>

Quote:
But when I try to connect to my application through Dev_space on my local computer through [http://localhost:10001/], it gives me a failed message.

I don't know if I miss some configuration in DEV_SPACE or in my Application or in the php.in file


What I have tried:

I tried to configure the dev space so that it can communicate with my application but in vain
Posted
Updated 25-Feb-18 21:33pm

1 solution

It working now after replacing the ; with a , in this line of codes to be like this:
$options = array (
CURLOPT_RETURNTRANSFER => true, 
CURLOPT_HTTPHEADER => array('Content-type : application/json'), 
CURLOPT_POSTFIELDS => $json_string);

And change the $data['meesage'] with $data['message']
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900