Jump to content

Challenge! Sending GET request in PHP code?


leesiulung

Recommended Posts

Is there a way to send a GET request via PHP code?

 

I need to send it to a url as follows:

 

http://www.mydomain.com/index.asp?email=emailaddress

 

The following is disabled:

 

getmyinode, getopt, getrusage, extension_loaded, dl, mysql_pconnect, crack_check, crack_closedict, crack_getlastmessage, crack_opendict, fsockopen, pfsockopen, mysql_list_dbs, mysql_stat, ini_get, ini_get_all, ini_alter, ini_set, get_current_user, get_defined_constants, get_include_path, php_ini_scanned_files, php_uname, phpcredits, restore_include_path, set_include_path, set_time_limit, version_compare, zend_version, getmypid, getmyuid, getmygid, assert_options, assert, fopen, fwrite, fread, file, fpassthru, file, mail, opendir, readdir, closedir

 

I'm on PHP4 on Windows. I cannot use curl with the following code:

 

<?php
$ch = curl_init('http://www.mysite.com/index.php?option=com_content&task=blogcategory&id=24&Itemid=55');
curl_exec ($ch);
curl_close ($ch);
?>

 

This suggest that I cannot use curl and is a limitation of my hosting company, GoDaddy....

 

Any programmers want to take me on the challenge and help me out?

Link to comment
Share on other sites

I'm not sure what socket function you are talking about?

 

I do not see this socket function as part of the disabled list I provided. I grabbed this list of phpinfo();.

 

Unfortunately, PHP hosting with Windows at GoDaddy leaves a lot to be desired. PHP on Linux does not support MS Access. MS Access support and PHP was a requirement....   :(>:(:(

Link to comment
Share on other sites

<?php
header("Location:http://www.mydomain.com/index.asp?email=emailaddress");
?>

 

I hope it works !

 

Unfortunately, that does not work because it would redirect the browser to a different page too. I need it to silently make the GET or POST in the background.

Link to comment
Share on other sites

You can use this then..  ;)

 

<?php
$ch = curl_init('http://www.mysite.com/index.php?option=com_content&task=blogcategory&id=24&Itemid=55');
curl_exec ($ch);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, "email=emailaddress");
curl_close ($ch);
?>

 

 

Link to comment
Share on other sites

curl do not seem to work with the server. Everytime I try to run curl_init() it always returns nothing (printed out on screen). I think this is equivalent of false. Since I do not see error messages (turned off and unable to turn on), I have no idea what is wrong.

 

Any other suggestions?

Link to comment
Share on other sites

Does fopen work for you?

 

I do not see fopen in the list of disabled functions. Do you mind posting a little code to save me a few hours of reading the help file and trying it out?

 

a good free host is igotfree.com if you have a domain

 

I'm stuck with godaddy. I just did not realize that their Windows hosting was that limited.... Dedicated or even virtual dedicated server would be best.

Link to comment
Share on other sites

How about an xmlhttp request?

 

 

That would work, but that means the client "can" know what I'm sending in the GET/POST since it would have the GET/POST data has to be sent to the client and then from the client back to the server.

 

I might have to just use a different scripting language... It seems like this is an impossible challenge....

Link to comment
Share on other sites

I might have to just use a different scripting language... It seems like this is an impossible challenge....

 

The fact is that php is capable of such functionality, just that your host seems to have disabled most of it.

Link to comment
Share on other sites

To those trying with the same issue with GoDaddy hosting, my solution ended up being to use an ASP page and post the information to this page. On errors, I would send a GET message back to the original PHP script.

 

As far as I know, PHP at GoDaddy is running on Safe Mode and is not officially supported on Windows platform. It also does not display errors in PHP scripts, even when you try to enable them in code.

Link to comment
Share on other sites

  • 7 months later...
  • 2 months later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.