Jump to content

Recommended Posts

hi,

I am trying to use the sample code provided by amazon awis to get alexa ranking. found here:

 

http://aws.amazon.com/code/402?_encoding=UTF8&binField_1=type&binValue_1=code&fromSearch=1&queryArg=searchQuery&searchQuery=awis%20php

 

but i want to be able to get rankings using my website rather than using a command prompt. i've been getting some help from the forum but nothing has fixed my issue. i keep getting $argv undefined

 

here is the code

 

http://semesterold.com/code2.html

Link to comment
https://forums.phpfreaks.com/topic/268889-using-command-line-to-run-php-file/
Share on other sites

Help from where? I don't see anything from you having to do with this.

 

Only the code at the very bottom forces it to be a command-line script. Remove it and write something else in its place so that you can do whatever you want. Meanwhile the code in the class outputs stuff directly so for the time being you might want to use a PRE or stick to a text-only page.

 

Otherwise what's your code?

well i dont have any code in there. I am trying to display alexa details (ranking, views etc) using the amazon api. I just edited the bottom portion. removed the if statement and put

 

//if (count($argv) < 1) {
//echo "Usage: site\n";
//exit(-1);
//}
//else {
$accessKeyId = "XXX";
$secretAccessKey = "XXX";
$site = "google.com";
//}

 

now i have an issue with curl_init. I'm using wamp and turned on curl but still i get

 

Call to undefined function curl_init()

 

is there another way to run this instead of using curl function?

how do i use file_get_contents in this case?

 

i did edit my php.ini file here

 

 

;extension=php_bz2.dll

extension=php_curl.dll <---

;extension=php_dba.dll

extension=php_mbstring.dll

;extension=php_exif.dll

;extension=php_fileinfo.dll

extension=php_gd2.dll

;extension=php_gettext.dll

;extension=php_gmp.dll

;extension=php_intl.dll

;extension=php_imap.dll

 

restarted wamp and still get the same error. shouldn't curl show up in phpinfo() as on or something? cause I can't find it there.

It should show up under phpfinfo. The only thing I can think of is that your CLI script is using a different ini file. If you were on Linux, I could show you a command how to tell easily, but since you are not, open up the command prompt and run:

 

php -r 'phpfinfo();'

 

And it should spit out a ton of stuff in text, look for the .ini line and make sure that is the .ini you are changing.

Note that PHP CLI and PHP CGI may have different php.ini files, and thus different settings. Not to mention they might have been compiled differently, so that some core functionality is not available on the CLI version.

So when testing with php -r 'phpinfo ();' you're getting the results for the CLI version only. To get the specifics for the CGI version as well you need to run it via the web browser.

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.