Jump to content

Archived

This topic is now archived and is closed to further replies.

leesiulung

Challenge! Sending GET request in PHP code?

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?

Share this post


Link to post
Share on other sites

Do you have access to the socket functions? Without that or curl your foobar'd. Pay for cheap hosting, get a cheap host.

Share this post


Link to post
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....   :(>:(:(

Share this post


Link to post
Share on other sites

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

 

I hope it works !

Share this post


Link to post
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.

Share this post


Link to post
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);
?>

 

 

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

Does fopen work for you?

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Wow, you have the worst host ever.

 

Use bluehost, there good guys - sat on the phone with me for 40 minutes getting Tidy to work.

 

Cheap ($100/year), great packages (server is a little slow) - bluehost.com

Share this post


Link to post
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....

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

GoDaddy allows you to create your own php.ini files. Doesn't that eliminate a lot of the headaches listed in the thread?

Share this post


Link to post
Share on other sites

i use godaddy with the linux package and i get all the normal functions. it is just slow sometimes.

Share this post


Link to post
Share on other sites

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