4
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by Biiim
0

fopen may not be allowed. "Bad Request" usually means you did not provide all/correct data. Hard to help you without knowing the API, nor seeing your code.

1

Hi,

If you want to pass a url via GET, which means to add that url in the link address, try with: file_get_contents('http://domain/page.php?name='. rawurlencode($the_url_to_pass)); , or with cUrl, but adding that url in the address encoding with rawurlencode().

Votes + Comments
nice
0
fopen("http://api.studentmug.com/bulksms/sms.php?Username=<something>&Password=<something>", "r");

Try using the local address to the file instead eg:

fopen("C://webhosting/studentmug.com/api/bulksms/sms.php?Username={$username}&Password={$password}", "r");

If that doesnt work you could combine it with what Marplo said and use file_get_contents() - i use file_get_contents with GET variables so i know that one will translate a web address

But is there any reason you cant use require('bulksms/sms.php'); ?

Then you have all the variables you had access to in the calling page eg.

index.php

<?php
$user = 'test';
$password = '1234';
require('bulksms/sms.php');

var_dump($success);
?>

bulksms/sms.php

<?php
if($password == '1234'){
    $success = true;
}else{
    $success = false;
}
?>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.